Creating Inline Spans

Part of the problem with replacing the old style tags like <b>, <i>, and <ins> with styles for individual items is that the style= argument must be placed within an existing tag. For example, in the following sentence, how would you avoid using <b> to make only one word bold?

<p>I had a <b>great</b> time.</p>

The word great does not have any container tags that surround it alone, so there’s no place to put a style= argument. The solution is to use an inline span. A span is simply a shell into which you can place any arguments you need. For example, the preceding example could be written as follows to use a style:

<p>I had a <span style="text-weight: bold">great</span> time.</p>

That’s an awful lot of typing, but there’s a good ...

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.