Frank Kluytmans
Frank Kluytmans

Reputation: 543

Change x value of SVG text from CSS

Is there anyway to change the x value of this text from my stylesheet?

< text class="jqx-chart-axis-text" x="7" y="11" width="50" height="37" cursor="default">70000

Upvotes: 6

Views: 7711

Answers (3)

MehulG
MehulG

Reputation: 131

You can use transform: translateX(5px) to change the x coordinate of text element.

Upvotes: 13

Erik Dahlstr&#246;m
Erik Dahlstr&#246;m

Reputation: 60976

You can indirectly affect it, but x isn't a css property (yet).

You can e.g affect text-anchor with CSS. In the future it should hopefully become possible to style the transform in svg content too, but atm it's not supported by all browsers.

Upvotes: 2

Eli
Eli

Reputation: 14827

CSS used for styling not changing value. You need to use Javascript in this case:

document.getElementById("jqx-chart-axis-text").setAttribute("x", "10");

Demo: http://jsfiddle.net/5sh6X/

Upvotes: 1

Related Questions