Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

how to set font-size font-family

Tags:

raphael

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

like image 250
coure2011 Avatar asked Sep 20 '10 08:09

coure2011


People also ask

How do I set relative font size?

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.

How do you add font size and font family in HTML?

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.

What is the difference between font size and font family?

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.


1 Answers

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" }); 
like image 150
C-Mo Avatar answered Sep 30 '22 16:09

C-Mo