Applying Bold and Italics

You learned how to apply bold and italic formatting by using the <b> and <i> tags in Part I of this book. You can continue to use those tags to format individual words and phrases, but you can’t use them in internal or external style sheets.

To include boldface in a style, use the font-weight argument. For example, you might create a class called boldface in your style sheet like this:

.boldface {font-weight: bold}

You can apply the boldface class to all text elements of a specified type, for example, all paragraphs, in style sheets.

p {font-weight: bold}

You can also apply it by using a style= argument in an individual paragraph.

<p style="font-weight: bold">This text is bold.</b>

One of the advantages of using a style for ...

Get HTML and XHTML Step by Step now with the O’Reilly learning platform.

O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.