i have code like this but its not working
var t = r.text(100, 100, 'test'); t.attr({font-size: 16});
giving me error
missing : after property id
here is documentation for raphael.js http://raphaeljs.com/reference.html
It is related to the font size of the parent container. One em (1em) is equal to the current font size. So for example, if the parent element has the font size of 16px than 1em is equal to 16px, 2em is equal to 32px, and so on. Making your design responsive becomes much easier if you use em units instead of px.
To change font size in HTML, use the CSS font-size property. Set it to the value you want and place it inside a style attribute. Then add this style attribute to an HTML element, like a paragraph, heading, button, or span tag.
And a “font family” represents a collection of related fonts, such as bold and italic variations of the same “typeface” or “font”. In summary, in common terminology, typeface (aka font) means the design, font means the file containing the typeface, and font-family means collection of related fonts.
For attributes with a hyphen in the name, you need to use a string literal.
var t = r.text(100, 100, 'test'); t.attr({ "font-size": 16, "font-family": "Arial, Helvetica, sans-serif" });
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With