Applying Bold and Italic Formatting

Boldface and italics are two ways of making text stand out from the rest. They are generally used in paragraphs rather than in headings, but they can be used anywhere.

For simple boldface and italics, use the <b> and <i> tags, respectively. These are two-sided tags that enclose the text to be formatted. For example:

<p>I had a <i>great</i> time at the party.</p>
<p>The reception will be held at <b>The Arbor Arch</b> in Plainfield.</p>

If you want to apply both bold and italic formatting, you can nest one tag inside the other. Don’t mix up their order, though. When nesting tags, the rule is: first in, last out. So this is correct:

<p>The next book we will read is <b><i>The Catcher in the Rye</i></b></p>

The following ...

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.