Thursday, 21 June 2012

How to make text Bold, Italic or Underline in a Web Page

Two more tags that come in useful are the Bold and Italic tags. They are quite easy to use. Here are the Bold tags:

<B> </B>

And here are the Italic tags:

<i> </i>

The text you want to change goes between the two tags:

<B> ... Rest of Hamlet's Soliloquy goes here</B>

<i> ... Rest of Hamlet's Soliloquy goes here</i>

If you want Bold and Italic text then you can nest the two:

<B><i> ... Rest of Hamlet's Soliloquy goes here</i></B>

The two I tags go between the two B tags. You can have it the other way around, though, with the I tags first:

<i><B> ... Rest of Hamlet's Soliloquy goes here</B></i>

Be careful of this, however:

<i><B> ... Rest of Hamlet's Soliloquy goes here</i></B>

This is a mismatched pair of tags. The two tags on the inside are B and I, and the ones on the outside are I and B. A modern browser will probably correct the mismatch, but older ones may not.

Try it in your HTML code:

Notepad showing the HTML B and I tags

Save and view the results in your browser:

Internet Explorer showing the HTML B and I tags in action.

There is also an underline tag you can use:

<U> ... Rest of Hamlet's Soliloquy goes here</U>

You can nest all three tags: bold, italics, and underline:

<U><B><i> ... Rest of Hamlet's Soliloquy goes here</i></B></U>

No comments:

Post a Comment