HTML Guides for font-style
Learn how to identify and fix common HTML validation errors flagged by the W3C Validator — so your pages are standards-compliant and render correctly across every browser. Also check our Accessibility Guides.
The font-style and font-weight properties serve different purposes. font-style controls whether text appears in a normal, italic, or oblique style, while font-weight controls how thick or thin the characters are rendered. Writing font-style: bold is a mistake because bold is not among the accepted values for font-style. Browsers will ignore the invalid declaration entirely, meaning your text won't become bold at all — it will simply render in the default weight.
This error typically comes from confusing the two properties or misremembering which property handles boldness. The valid values for each property are:
font-style:normal,italic,oblique, orobliquewith an angle (e.g.,oblique 10deg)font-weight:normal,bold,bolder,lighter, or numeric values from100to900
To fix this issue, replace font-style: bold with font-weight: bold. If you intended to make text both bold and italic, you'll need to use both properties separately.
Examples
Incorrect — using bold with font-style
This triggers the validation error because bold is not a valid font-style value:
<pstyle="font-style: bold;">This text won't actually be bold.</p>
Correct — using font-weight for boldness
Move the bold value to the font-weight property:
<pstyle="font-weight: bold;">This text is bold.</p>
Correct — combining bold and italic
If you want text that is both bold and italic, use both properties:
<pstyle="font-weight: bold;font-style: italic;">This text is bold and italic.</p>
Correct — using font-weight in a stylesheet
You can also apply bold styling through a <style> block or external stylesheet, using either keyword or numeric values:
<style>
.emphasis{
font-weight: bold;
}
.light{
font-weight:300;
}
.heavy{
font-weight:900;
}
</style>
<pclass="emphasis">This text is bold (weight 700).</p>
<pclass="light">This text is light (weight 300).</p>
<pclass="heavy">This text is extra heavy (weight 900).</p>
Note that the keyword bold is equivalent to the numeric value 700, and normal is equivalent to 400. Numeric values give you finer control over text weight, especially when using variable fonts or font families that offer multiple weight variations.
The font-style CSS property controls whether text is displayed in a normal, italic, or oblique face from its font-family. It has a limited set of accepted values, and the W3C validator will flag any value that falls outside this set.
This error commonly occurs for a few reasons:
- Confusing
font-stylewithfont-size: Since both properties start withfont-, it's easy to accidentally typefont-style: 1.2emwhen you meantfont-size: 1.2em. Numeric and length values are not valid forfont-style. - Confusing
font-stylewithfont-weight: Writingfont-style: boldis invalid becauseboldis afont-weightvalue, not afont-stylevalue. - Typos in keyword values: Misspelling a valid keyword, such as
font-style: itallicorfont-style: oblque, will trigger this error. - Using the
obliqueangle syntax incorrectly: Whileobliquecan accept an optional angle (e.g.,oblique 10deg), providing an angle without theobliquekeyword or using an invalid unit will cause a validation error.
Using invalid CSS values can lead to unpredictable rendering across browsers. Most browsers will ignore the entire declaration when they encounter an invalid value, meaning your intended styling won't be applied at all. Keeping your CSS valid ensures consistent behavior and makes debugging easier.
Valid font-style values
The accepted values for font-style are:
normal— displays the normal face of the font family.italic— selects the italic face; falls back toobliqueif unavailable.oblique— selects the oblique face; optionally accepts an angle value (e.g.,oblique 10deg). The angle defaults to14degif omitted.- Global CSS values:
inherit,initial,revert,revert-layer,unset.
Examples
Incorrect: size value applied to font-style
This is the most common mistake — using a length value that belongs on font-size:
<pstyle="font-style:1.2em;">This text has an invalid font-style.</p>
Correct: use font-size for size values
<pstyle="font-size:1.2em;">This text has a valid font size.</p>
Incorrect: using bold with font-style
<pstyle="font-style: bold;">This text has an invalid font-style.</p>
Correct: use font-weight for boldness
<pstyle="font-weight: bold;">This text is bold.</p>
Incorrect: misspelled keyword
<pstyle="font-style: itallic;">This text has a typo in font-style.</p>
Correct: properly spelled keyword
<pstyle="font-style: italic;">This text is italic.</p>
Correct: using oblique with an angle
<pstyle="font-style: oblique 12deg;">This text is oblique at 12 degrees.</p>
Quick reference for commonly confused properties
If you're unsure which property to use, here's a quick guide:
| You want to change… | Use this property | Example value |
|---|---|---|
| Italic or oblique text | font-style | italic, oblique |
| Text size | font-size | 1.2em, 16px |
| Text boldness | font-weight | bold, 700 |
| Text decoration | text-decoration | underline, line-through |
Validate at scale.
Ship accessible websites, faster.
Automated HTML & accessibility validation for large sites. Check thousands of pages against WCAG guidelines and W3C standards in minutes, not days.
Pro Trial
Full Pro access. Cancel anytime.
Start Pro Trial →Join teams across 40+ countries