CSS: Applying bold and italics

This entry is part 12 of 26 in the series Basic CSS

Using HTML, we can use <b> or <i> to apply bold and italics formatting to font.

In CSS, we use the font-weight attribute.

To apply italic formatting, we use the font-style attribute.

<!DOCTYPE html>
<html>
<head lang='en'>
    <meta charset='UTF-8'>
    <title>Codecrawl.com-Font</title>
    <style type='text/css'>
        .boldface {
            font-weight: bold;
            font-family: 'Arial';
        }
        .italics {
            font-style: italic;
            font-family: 'Arial';
        }
    </style>
</head>
<body>

<p class='boldface'>Ushuaia is commonly regarded as the southernmost city in the world</p>
<p class='italics'>During the 1880s, many gold prospectors came to Ushuaia following rumors of large gold fields, which proved to be false.</p>

</body>
</html>

Series Navigation<< CSS: Specifying font size
CSS: Strikethrough and underlining >>