SVG: Font Size
This page shows what the size unit mean exactly for
Default Font Size
If no font size is set, default is 16.
Font Size Means Baseline to Baseline
Font size means baseline to baseline.
Note that a font size means the box a font is designed in. It includes empty spaces above and below.
[see Meaning of Font Size]
Unit is User Coordinate
When you use font size attribute, e.g.
<text x="0" y="100" font-size="16">E 16</text>,
the unit is user coordinate.
[see SVG: viewBox, User Coordinate]
Percentage value for
font-size means with respect to default
font-size="100%" is the same as
font-size Attribute vs CSS
Font size can also be specified by CSS, example:
When using CSS, a unit such as “px” is required. (this is required by CSS)
When using CSS, the “px” length has exact same meaning as SVG font size attribute without unit.
CSS unit such as
em do not work.
CSS value such as
, are translated into 16px, which in turn is 16 units in SVG user coordinates.
They may become tiny or invisible, or huge and fill the screen, when you use user coordinates.
Percentage Value with CSS
Percentage value with CSS has the same meaning as SVG attribute.
User Coordinate's Unit Size
For how to compute a good font size when in user coordinate,
SVG: ViewBox, User Coordinate's Unit Size
Text – SVG 1.1 (Second Edition)#FontSizeProperty