- Get link
- X
- Other Apps
font-weight
In CSS, to make the text thick and bold, we can use font-weight property. It controls the boldness or thickness of the text. The value can be set as normal(default value), bold,bolder, and lighter.
The HTML Code:
<p class="lighter"> This is a font with a "lighter" weight.
</p>
<p class="bold">This is a font with a "bold" weight.
</p>
<p class="bolder">This is a font with a "bolder" weight.
</p>
The CSS Code:
p.lighter{
font-weight:lighter;
}
p.bold{
font-weight:bold;
}
p.bolder{
font-weight:bolder;
}
Result:
Note:-You can also define the font weight with a number from 100[thin] to 900[thick]. 400 is same as normal and 700 is the same as bold.
The HTML and Inline Code:
<html>
<head>
<style>
p.lighter{
font-weight:100;
}
p.thick{
font-weight:600;
}
p.thicker{
font-weight:900;
}
</style>
</head>
<body>
<p class="lighter"> This is a font with a "100" weight.</p>
<p class="thick">This is a font with a "600" weight.</p>
<p class="thicker">This is a font with a "900" weight.</p
</body>
</html>
</body>
</html>
Result:
Comments
Post a Comment
If you have any doubt, ask here