HTML and CSS Reference
In-Depth Information
Figure 2.2 Two paragraphs as displayed on a web page
Bold Text with Strong
To make text bold and place a strong importance on it, we'll use the <strong> inline-
level element. There are two elements that will bold text for us: the <strong> and <b>
elements. It is important to understand the semantic difference between the two.
The <strong> element is semantically used to give strong importance to text, and is thus
the most popular option for bolding text. The <b> element, on the other hand, semantic-
ally means to stylistically offset text, which isn't always the best choice for text deserving
prominent attention. We have to gauge the significance of the text we wish to set as bold
and to choose an element accordingly.
Here are the two HTML options for creating bold text in action (see Figure 2.3 ) :
Click here to view code image
1. <!-- Strong importance -->
2. <p> <strong> Caution: </strong> Falling rocks.</p>
3.
4. <!-- Stylistically offset -->
5. <p>This recipe calls for <b> bacon </b> and <b> baconnaise </b> .</p>
Figure 2.3 Using the <strong> and <b> elements to bold text properly, the word
“Caution:” is semantically interpreted as having strong importance , and the words “ba-
con” and “baconnaise” are semantically interpreted as being stylistically offset
Italicize Text with Emphasis
To italicize text, thereby placing emphasis on it, we'll use the <em> inline-level element.
As with the elements for bold text, there are two different elements that will italicize text,
each with a slightly different semantic meaning.
Search WWH ::




Custom Search