Reputation: 2458
The SVG 1.1 standard says that the font-size
attribute is allowed in text content elements. The <g>
element is not a text content element. Conclusively, the <g font-size="45"/>
is illegal.
However, many examples in the standard show <g>
-elements with the font-size
attribute.
Is the attribute allowed in <g>
elements or are the examples showing invalid code?
Upvotes: 1
Views: 1141
Reputation: 124006
font-size is an inherited CSS property so if you set it on a parent element, it applies to all that element's children.
It can have an indirect effect on non-text elements if they use em or ex units i.e. they are sized relative to the font-size. What the specification is trying (pretty poorly) to say is that setting a font-size on a rect element won't have any effect.
The specification for a g element is explicit that font-size is a property it supports. Click on the presentation-attributes link in the g element section on that page and the text will expand to show font-size as a supported attribute.
Upvotes: 4