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.
Categories | Presentation attribute |
---|---|
Value | <absolute-size> | <relative-size> | <length> | <percentage> | inherit |
Initial value | medium |
Animatable | Yes |
Normative document | SVG 1.1 (2nd Edition) |
h1 {font-size:30px;} h2 {font-size:20px;} p {font-size:15px;}
<h1>30pixel</h1> <h2>20pixel</h2> <p>15pixel</p>
h1 {font-size:2.9em;} h2 {font-size:1.9em;} p {font-size:0.9em;}
<h1>2.9em</h1> <h2>1.9em</h2> <p>0.9em</p>
The following elements can use the font-size
attribute
© 2005–2018 Mozilla Developer Network and individual contributors.
Licensed under the Creative Commons Attribution-ShareAlike License v2.5 or later.
https://developer.mozilla.org/en-US/docs/Web/SVG/Attribute/font-size