Home > Article > Web Front-end > How to make font bold in css
You can use the font-weight attribute to bold a font in CSS. The default value is normal, and the bold value is bold. It also supports lighter (lighter), heavier (bolder), and 100-900 values (400 is normal ).
Bold fonts in CSS
Bold fonts in CSS is very simple, you can usefont-weight
attribute.
HTML Code
<code class="html"><p>这是普通文本</p> <p><strong>这是加粗文本</strong></p></code>
CSS Code
<code class="css">p { font-weight: normal; } strong { font-weight: bold; }</code>
In this example, normal
is the font The default weight of , while bold
is the bold weight.
In addition to normal
and bold
, the font-weight
property also supports the following values:
Example
To make text bold to medium weight, you can use the following CSS:
<code class="css">p { font-weight: 600; }</code>
Browser support
# The ##font-weight attribute is well supported by all modern browsers.
The above is the detailed content of How to make font bold in css. For more information, please follow other related articles on the PHP Chinese website!