Deprecated in HTML5. Do not use.

Font Weight Is Deprecated In HTML5, But Here's The New CSS

Disclosure: Your support helps keep the site running! We earn a referral fee for some of the services we recommend on this page. Learn more
Attribute of
<font> HTML Tag
What does Font Weight Is Deprecated In HTML5, But Here's The New CSS do?
Was used to indicate the weight (boldness) of text. Deprecated. Use CSS instead.
The Font Element and it’s Attributes have been Deprecated This attribute has been deprecated and should not be used. Browser support for this attribute is limited and using it may produce unexpected results. Instead, use CSS. Learn more by reading our tutorial on Fonts and Web Typography.

The CSS font-weight property indicates how bold the characters should be. font-weight can be assigned a multiple of 100 from 100 to 900 (900 being the boldest). So, for example, this rule (added to an HTML document in a STYLE tag or in an external style sheet) says that <H2> elements should have a weight of 900:

h2 {   font-weight: 900; } 

which means that an <H2> element is rendered like this:

Weighty Matters

You can also use the words “normal” (the same as 400), “bold” (same as 700), “bolder” (a relative statement meaning to make the text bolder than the surrounding element), or “lighter” (make the text lighter than the surrounding element). Because few fonts have nine shades of boldness, in most fonts 100 to 500 are the same, 600 to 800 are the same, and 900 is boldest. One of the ramifications of this is that although “normal” is 400, in many cases 100 is not really any lighter. Unless you’re using a typeface with many available font weights there is no practical way to present text with less-than-normal weight. To learn more about this topic see our tutorial on Fonts and Web Typography.

Adam is a technical writer who specializes in developer documentation and tutorials.