Styling bits and pieces - A Smarter Way To Learn HTML & CSS (2015)

A Smarter Way To Learn HTML & CSS(2015)

11
Styling bits and pieces

So far you’ve been using CSS to style whole blocks of text—paragraphs and headings. But you can also style bits and pieces of those blocks using the <span> tag. Let’s go back to the emphasized class from the last chapter.

.emphasized {
font-style: italic;
}

Since the class, as you defined it, isn’t tied to any particular text element—it isn’t p.emphasized or h5.emphasized but just .emphasized—it can be applied to any text you choose, including part of a paragraph or heading. In the following paragraph the words “so much” are italicized.

<p>I love you <span class="emphasized">so much</span> I have to use italics.</p>

In your HTML file italicize a portion of the paragraph you created in the last chapter, using a span class of “emphasized.” Save your HTML file and display it.

Sample HTML code is at:
http://asmarterwaytolearn.com/htmlcss/practice-11-1.html.
Find the interactive coding exercises for this chapter at:
http://www.ASmarterWayToLearn.com/htmlcss/11.html