HTML Guide for stroke-width
Use a non-negative value for the CSS property stroke-width; negative lengths are invalid.
In SVG and CSS, the stroke-width property controls the thickness of the outline of shapes and text. It accepts non-negative numbers with optional units. A value of 0 is allowed (renders no visible stroke), but any negative value is invalid per the SVG and CSS specifications and will trigger validator errors.
You can specify stroke-width in user units (unitless, in the current SVG coordinate system) or with CSS length units like px. Common valid values: 0, 1, 2, 0.5, 3px. Avoid negative values and avoid quotes if you’re writing CSS; quotes are only appropriate inside HTML attributes when setting a style string.
If you were using a variable or calculation that could produce a negative number, clamp it to 0 or a minimum positive value.
HTML Examples
Example that reproduces the validator error
<p style="stroke-width: -1">some content</p>
Corrected example with a valid non-negative stroke width
<p style="stroke-width: 0">some content</p>