Basic Tags
Now that you know a few tags for formatting text it's time to learn some
other basic tags so that you can start to create some more interesting
HTML documents.
Bold, Underline, and Italic
There are a few different tags which can accomplish bold, underline, and
italic text. The difference between the methods is that some are
Logical styles while others are Physical styles, the
difference will be explained below.
There are two ways to create bolded text, the first way is by using the
<strong> </strong> element:
<strong>this text is in bold</strong>
The other way is by using the <b> </b> element, which stands
for bold:
<b>this text is in bold</b>
Note that in lynx the text is not displayed as bold but is instead
displayed as underlined.
There are also two ways to create italic text. The first way is by using
the <em> </em> element, which stands for emphasis:
<em>this text is in italic</em>
The other way is by using the <i> </i> element, which stands
for italic:
<i>this text is in italic</i>
Like bold text, lynx displays both methods of italic text as underlined.
There is one way to create underlined text, by using the <u>
</u> element, which stands for underline:
<u>this text is underlined</u>
Logical and Physical Styles
There are two different ways to do character formatting in HTML, one is
logical style, the other is physical style. The concept behind HTML is
that the HTML document only describes how the text behaves but that the
individual browsers determine how the page actually looks. What this
means is that the browser can be set to display the tags the way that the
user wants them to be displayed, this is what a logical style does.
<strong> and <em> are both examples of logical styles. If you
look at what the tags stand for this makes a bit more sense, they stand
for strong and emphasis. Nowhere in the tag does it really say how that
tag should be displayed, strong could be set to be displayed as red for
instance.
Sometimes though you want a character to be displayed a certain way and
not give the browser any choice about it. This is what a physical style
is. <b>, <i>, and <u> are all physical styles. Again,
this is clear when you look at what they stand for; bold, italic, and
underline. Here the tag does specifically say how the text should be
displayed.
The question of which tags you should use is largely a personal one and
it will also depend on how you want the page to work. Just remember that
lynx can't handle different types of text so they always get displayed as
underlined. When viewed in a graphical browser then you do see the text
displayed like the tag says it should be.
Horizontal Rule
The horizontal rule is a horizontal line across the screen:
and is created with the <hr> tag. It can be very useful for
dividing sections of a document. The example shown is centered and is
of a width of 60%, making the appearance of the line less heavy and
overbearing and is created with the following tag: