HTML Guide for font-size
The value passed to the font-size property is invalid, probably missing the amount of px.
The font-size CSS property sets the size of the font, and this size can be expressed in different units, like em, % or px.
Example:
<!DOCTYPE html>
<html>
<head>
<title>Font-size Example</title>
<style>
p {
font-size: 16px;
}
</style>
</head>
<body>
<p>This is an example of a paragraph with a font-size of 16px.</p>
</body>
</html>
This issue is a false positive by the W3C validator, fixed in the latest versions of Nu Validator.
The value revert is indeed a valid value for the CSS property font-size.
A value specified for the font-size property in your CSS is not a valid CSS length or keyword.
The font-size property accepts values such as keywords (small, large), absolute and relative lengths (px, em, rem, pt), or percentages. Invalid values, like font-size: X;, are not recognized and trigger a validation error.
Common valid values for font-size:
- Keywords: small, medium, large, etc.
- Length units: 12px, 1em, 0.9rem, 10pt
- Percentages: 120%
Example with a valid value:
<p style="font-size: 16px;">This text uses a valid font size.</p>
Example using a keyword:
<p style="font-size: large;">This text uses a valid keyword.</p>
Full HTML example (valid):
<!DOCTYPE html>
<html lang="en">
<head>
<title>Valid Font Size Example</title>
</head>
<body>
<p style="font-size: 1.2em;">Valid font size using em unit.</p>
</body>
</html>
Check that all font-size values use proper CSS units or accepted keywords to resolve the validation warning.
The font-style CSS property sets whether a font should be styled with a normal, italic, or oblique face from its font-family.
Here are examples of valid font-style values:
font-style: normal;
font-style: italic;
font-style: oblique;
font-style: oblique 10deg;
/* Global values */
font-style: inherit;
font-style: initial;
font-style: revert;
font-style: revert-layer;
font-style: unset;
A common issue is trying to use font-style to define the size, when font-size should have been used instead, for example:
/* Invalid */
font-style: 1.2em;
/* Valid */
font-size: 1.2em;