JavaScript EditorDebugger script     Dhtml css 



Team LiB
Previous Section Next Section

Adding Italic and Bold

The I (Italic) and B (Bold) elements are used to italicize or bold text; the EM (Emphasis) and STRONG (Strong Emphasis) elements are used to emphasize or strongly emphasize text. In practice, however, the I and EM elements produce the same result (italicized text), as do the B and STRONG elements (bolded text). The only difference between the two is that the I and B elements literally describe, whereas the EM and STRONG elements logically indicate, the result that is to be achieved.

Which to use is really a matter of personal choice and preference. If you want to be more faithful to the initial idea behind HTML, which was to structure rather than describe a page, use the EM and STRONG elements. If you want to save some keystrokes, however, use the I and B elements. The result will be the same, whichever you choose.

To create text that is both italicized and bolded (or emphasized and strongly emphasized), just nest a B element inside of an I element (or a STRONG element inside of an EM element), or you can do it the other way around.

In the following example, apply italic and bold highlighting using both the I and B elements and the EM and STRONG elements (see Figure 2.4):

<h1>Miranda's World</h1>
<p>Welcome to my world! My name is <i><b>Miranda
Jones</b></i>. I'm a sophomore at Excelsior College, majoring
in <i>urban horticulture</i>. When not studying, my favorite
activity is <em>inline skating</em>, which is <b>great
exercise</b>, but also a lot of <strong>fun</strong>.
Continue reading to find out more about my interests,
activities, family, friends, hobbies, causes, or anything
else I see fit to include. While this page is fairly simple
to start out, I hope to expand it later to be much more
comprehensive.</p>
Click To expand
Figure 2.4: The I and the EM elements are presented in italics, whereas the B and STRONG elements are presented as bolded.

Team LiB
Previous Section Next Section


JavaScript EditorDebugger script     Dhtml css