font-size

« SVG Attribute reference home

The font-size attribute refers to the size of the font from baseline to baseline when multiple lines of text are set solid in a multiline layout environment. For SVG, if a <length> is provided without a unit identifier (e.g., an unqualified number such as 128), the browser processes the <length> as a height value in the current user coordinate system.

If a <length> is provided with one of the unit identifiers (e.g., 12pt or 10%), then the browser converts the <length> into a corresponding value in the current user coordinate system

As a presentation attribute, it also can be used as a property directly inside a CSS stylesheet, see css font-size for further information.

Usage context

Categories Presentation attribute
Value <absolute-size> | <relative-size> | <length> | <percentage> | inherit
Initial value medium
Animatable Yes
Normative document SVG 1.1 (2nd Edition)

Example

font size with pixel

css

h1 {font-size:30px;}
h2 {font-size:20px;}
p {font-size:15px;}

html

<h1>30pixal</h1>
<h2>20pixal</h2>
<p>15pixal</p>

font size with Em

css

h1 {font-size:2.9em;}
h2 {font-size:1.9em;}
p {font-size:0.9em;} 

html

<h1>2.9em</h1>
<h2>1.9em</h2>
<p>0.9em</p>

Elements

The following elements can use the font-size attribute

See also

Document Tags and Contributors

Contributors to this page: dhaval, Jeremie
Last updated by: dhaval,