Search results
Top results related to how to bold text in css
Learn how to set different font weight for text using the font-weight property in CSS. See examples, syntax, values, browser support and related pages.
- Demo ❯
Demo of the different values of the font-weight property....
- Font-Family
W3Schools offers free online tutorials, references and...
- CSS Initial Keyword
W3Schools offers free online tutorials, references and...
- Demo ❯
- Overview
- Syntax
- Accessibility concerns
- Browser compatibility
- GeneratedCaptionsTabForHeroSec
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.
Learn how to use the font-weight CSS property to set the weight (or boldness) of the font. See the syntax, values, examples, and browser compatibility of this property.
Mar 2, 2023 · Learn how to use the font-weight property to create bold text in HTML using inline, internal or external CSS styling. Follow best practices for choosing the right font-weight, balancing bold text with other formatting options, and testing for accessibility.
Dec 6, 2016 · Want to distinguish a defined keyword from the surrounding text defining or explaining it? Use a "dfn" element and suggest a bold style for it within your CSS ("dfn {font-weight: bold;}"). Want to distinguish some computer code from surrounding text? Use a "code" element and suggest a bold style for it within your CSS ("code {font-weight: bold;}").
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. The available keywords are: normal. bold.
People also ask
How do I make text bold in HTML?
How to make fonts bold in CSS?
Why should you use bold text in HTML?
How do I use a bold> tag in HTML?
Feb 8, 2024 · Learn how to use HTML tags, CSS properties, and font weights to make your fonts bold in web development. Find out the difference between b and strong, and how to adjust font-weight with numbers or relative values.
Aug 16, 2023 · The most straightforward method to make text bold is by adjusting the ‘font-weight’ property. The ‘font-weight’ property accepts values ranging from ‘100’ (thin) to ‘900’ (heavy/bold). The commonly used values for bold text are ‘bold’ and ‘700’.