appendix a

Additional HTML Markup for Text

Throughout this book, you have learned about several HTML elements that can be used for layout and content markup. In this appendix, I cover some additional HTML elements that can be used to mark up your text content.

Indicating Importance

The <strong> element is used to signify that a piece of text is important and should be noted. Browsers will usually display the content as bold text; however, it is important to understand that by putting text within a <strong> element you are also altering its semantic meaning. You should not use it purely for styling purposes. (In those cases, you should use the <span> element and CSS, as discussed later in this appendix.)

<p>

  <strong>Do not cross the bridge</strong>, as the support

  structure has been weakened.

</p>

In the preceding example, I use the <strong> element to indicate that the instruction is more important than the explanation.

Emphasizing Text

The <em> element is used to place emphasis on a particular word or phrase. This element can be used to change the meaning of a sentence and indicates that the content should be read with a different mood or voice. The following example conveys the tone that someone is very passionate about HTML5.

<p>HTML5 <em>rocks</em>!</p>

This would appear in most browsers as “HTML5 rocks!”

Browsers will usually style text within the <em> element in italics, but again, it should not be used purely for styling purposes. Using a <span> element with CSS would ...

Get HTML5 Foundations 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.