Home  >  Article  >  Web Front-end  >  How to set bold in css

How to set bold in css

醉折花枝作酒筹
醉折花枝作酒筹Original
2021-04-20 15:39:3215120browse

In CSS, you can use the "font-weight" attribute to set boldness. You only need to set the "font-weight:bold|700" style to the element. The font-weight attribute sets the thickness of the text. The numeric value 700 is equivalent to bold. When the value is bold, it means defining bold characters.

How to set bold in css

The operating environment of this tutorial: Windows 7 system, CSS3&&HTML5 version, Dell G3 computer.

Create a new HTML page, add the HTML structure, and then add fonts in the body area, placing it in a div.

<body>
<div>枯藤老树昏鸦</div>
</body>

Next, you can use font-weight to set boldness in CSS. You only need to set bold.

<style>
div {
    font-weight: bold;
    }
</style>

After running the page, you can see that the font is bolded

How to set bold in css

In addition, font-weight can also be set to a value from 100 to 900. Larger numbers are bolder.

<style>
div {
    font-weight: 100;
    }
</style>

When font-weight is set to 100, the font is the thinnest

How to set bold in css

Finally, when font-weight is set to 900, it is The thickest

How to set bold in css

Recommended learning: css video tutorial

The above is the detailed content of How to set bold in css. For more information, please follow other related articles on the PHP Chinese website!

Statement:
The content of this article is voluntarily contributed by netizens, and the copyright belongs to the original author. This site does not assume corresponding legal responsibility. If you find any content suspected of plagiarism or infringement, please contact admin@php.cn