Skip to main content

HTML Guide

Bad value “none” for attribute “font-weight” on element “g”.

The attribute font-weight can be used on SVG text elements like text but not on g container elements, and none is not a valid value.

The font-weight attribute refers to the boldness or lightness of the glyphs used to render the text, relative to other fonts in the same font family.

This attribute can be used with the SVG elements text, textPath, tref and tspan, but on on g elements.

Its allowed values are normal, bold, bolder, lighter, or a number. The value none is not valid for this attribute.

Here’s an example:

<svg viewBox="0 0 200 30" xmlns="http://www.w3.org/2000/svg">
  <text y="20" font-weight="normal">Normal text</text>
  <text x="100" y="20" font-weight="bold">Bold text</text>
</svg>

Alternatively, SVG text elements can also be stilyzed using CSS, like so:

<svg viewBox="0 0 200 30" xmlns="http://www.w3.org/2000/svg">
  <text y="20" style="font-weight:normal">Normal text</text>
  <text x="100" y="20" style="font-weight:bold">Bold text</text>
</svg>

Learn more:

Related W3C validator issues