Search results
Try it Yourself » Definition and Usage. The font-weight property sets how thick or thin characters in text should be displayed. Show demo . Browser Support. The numbers in the table specify the first browser version that fully supports the property. CSS Syntax. font-weight: normal|bold|bolder|lighter| number |initial|inherit; Property Values.
- Font Style
p.thick { font-weight: bold; } Try it Yourself » Font...
- Font Style
p.thick { font-weight: bold; } Try it Yourself » Font Variant. The font-variant property specifies whether or not a text should be displayed in a small-caps font. In a small-caps font, all lowercase letters are converted to uppercase letters.
- Overview
- Syntax
- Accessibility concerns
- Browser compatibility
The font-weight CSS property sets the weight (or boldness) of the font. The weights available depend on the font-family that is currently set.
Values
normal Normal font weight. Same as 400. bold Bold font weight. Same as 700. A value between 1 and 1000, both values included. Higher numbers represent weights that are bolder than (or as bold as) lower numbers. This allows fine-grain control for variable fonts. For non-variable fonts, if the exact specified weight is unavailable, a fallback weight algorithm is used — numeric values that are divisible by 100 correspond to common weight names, as described in the Common weight name mapping section below. lighter One relative font weight lighter than the parent element. Note that only four font weights are considered for relative weight calculation; see the Meaning of relative weights section below. bolder One relative font weight heavier than the parent element. Note that only four font weights are considered for relative weight calculation; see the Meaning of relative weights section below.
Fallback weights
If the exact weight given is unavailable, then the following rule is used to determine the weight actually rendered: •If the target weight given is between 400 and 500 inclusive: •Look for available weights between the target and 500, in ascending order. •If no match is found, look for available weights less than the target, in descending order. •If no match is found, look for available weights greater than 500, in ascending order. •If a weight less than 400 is given, look for available weights less than the target, in descending order. If no match is found, look for available weights greater than the target, in ascending order. •If a weight greater than 500 is given, look for available weights greater than the target, in ascending order. If no match is found, look for available weights less than the target, in descending order.
Meaning of relative weights
When lighter or bolder is specified, the below chart shows how the absolute font weight of the element is determined. Note that when using relative weights, only four font weights are considered — thin (100), normal (400), bold (700), and heavy (900). If a font family has more weights available, they are ignored for the purposes of relative weight calculation.
People experiencing low vision conditions may have difficulty reading text set with a font-weight value of 100 (Thin/Hairline) or 200 (Extra Light), especially if the font has a low contrast color ratio.
•MDN Understanding WCAG, Guideline 1.4 explanations
BCD tables only load in the browser with JavaScript enabled. Enable JavaScript to view data.
Nov 22, 2014 · Another approach would be to use the font-weight property. You can achieve inline, or via a class or id. Let's say you're using a class. .className { font-weight: bold; } Alternatively, you can also use a hard value for font-weight and most fonts support a value between 300 and 700, incremented by 100. For example, the following would be bold:
Definition and Usage. The font-weight property sets how thick or thin characters in text should be displayed. Browser Support. The numbers in the table specify the first browser version that fully supports the property. CSS Syntax. font-weight: normal|bold|bolder|lighter| number |initial|inherit; Property Values. Related Pages.
- yes. Read about animatable Try it
- yes
- normal
- CSS1
Mar 2, 2023 · One common formatting technique is to make text bold using the font-weight property. Bold text can add emphasis to key information, create visual contrast, and improve the readability of content. In this article, you will learn how to use CSS to make text bold in HTML using the font-weight property. Whether you're a beginner or an experienced ...
People also ask
What is font weight in CSS?
How do I use font weight in JavaScript?
What is a font-weight property?
How do I specify font weight?
How do I use bold text in HTML?
What font weights are available?
Jun 17, 2013 · The font-weight property sets the weight, or thickness, of a font and is dependent either on available font faces within a font family or weights defined by the browser. span { font-weight: bold; } The font-weight property accepts either a keyword value or predefined numeric value.