If you have ever done any wordprocessing using e.g. Word you definitely know of the opportunity to use bold, italics and underlined text.
When writing CSS, these characteristics are spread over several properties and this is why I have grouped them together into a single chapter.
The CSS font-weight property defines whether the font weight(i.e thickness of the font).
The Visual result of each numeric value of font-weight, must be atleast as light as the next lowest number an atleast as heavy as the next highest number.
<style> Element{font-weight: normal | bold | bolder | lighter | 100 | 200 | 300 | 400 | 500 | 600 | 700 | 800 | 900;} </style>
<!DOCTYPE html> <html> <head> <style> p.normal { font-weight: normal; } p.light { font-weight: lighter; } p.thick { font-weight: bold; } p.thicker { font-weight: 900; } </style> </head> <body> <h1>The font-weight Property</h1> <p class="normal">This is a paragraph.</p> <p class="light">This is a paragraph.</p> <p class="thick">This is a paragraph.</p> <p class="thicker">This is a paragraph.</p> </body> </html>
This is a paragraph.
This is a paragraph.
This is a paragraph.
This is a paragraph.
Value | Description |
---|---|
normal | Defines normal characters. This is default |
bold | Defines thick characters |
bolder | Makes text bolder. |
lighter | Makes the text lines thin. |
100 – 900 | Sets the boldness of the font. The default is 400, and bold is 700. |