Chapter: 9.4 HTML Text Topic: 9.4.1 HTML Text: E-Content of Internet Technology and Web Design
Chapter: 9.4 HTML Text Topic: 9.4.1 HTML Text: E-Content of Internet Technology and Web Design
HTML Text
• The text on HTML page can be altered in a number of ways.
• The actual font used can be changed to attempt to force the browser to use a
specific font and the look of the text can be changed for emphasis.
• Web page authors who are worried about issues of usability and who want to
create pages which work across different types of device frown upon the
elements in this section.
• It is a really good idea to use styles wherever possible.
• The forthcoming XHTML 2 recommendation even suggests that the style
attribute will disappear, to be replaced by a new element.
• Unfortunately many HTML editing tools still use the elements and attributes listed
here so the chances are that you will come across these at some point.
• Be aware that whenever you are able to write your code by hand, or if you have
user configurable tool, you should use styles.
• If you use a word processor, you must be familiar with the ability to make text
bold, italicized, or underlined; these are just three of the ten options available to
indicate how text can appear in HTML and XHTML.
Bold Text
• Anything that appears within <b>...</b> element, is displayed in bold.
• Example program
Page | 31
E-Content of
INTERNET TECHNOLOGY AND WEB DESIGN
• Output
Italic Text
• Anything that appears within <i>...</i> element is displayed in italicized.
• Example program
• Output
Underlined Text
• Anything that appears within <u>...</u> element, is displayed with underlined.
• Example program
Page | 32
E-Content of
INTERNET TECHNOLOGY AND WEB DESIGN
• Output
Strike Text
• Anything that appears within <strike>...</strike> element is displayed with strike
through, which is a thin line through the text.
• Example program
• Output
Monospaced font
• The content of a <tt>...</tt> element is written in monospaced font.
• Most of the fonts are known as variable-width fonts because different letters are
of different widths (for example, the letter 'm' is wider than the letter 'i').
• In a monospaced font, however, each letter has the same width.
• Example program
Page | 33
E-Content of
INTERNET TECHNOLOGY AND WEB DESIGN
• Output
Superscript Text
• The content of a <sup>...</sup> element is written in superscript; the font size
used is the same size as the characters surrounding it but is displayed half a
character's height above the other characters.
• Example program
• Output
Subscript Text
• The content of a <sub>...</sub> element is written in subscript; the font size
used is the same as the characters surrounding it, but is displayed half a
character's height beneath the other characters.
• Example program
Page | 34
E-Content of
INTERNET TECHNOLOGY AND WEB DESIGN
• Output
Inserted Text
• Anything that appears within <ins>...</ins> element is displayed as inserted text.
• Example program
• Output
Deleted Text
• Anything that appears within <del>...</del> element is displayed as deleted text.
• Example program
Page | 35
E-Content of
INTERNET TECHNOLOGY AND WEB DESIGN
• Output
Larger Text
• The content of the <big>...</big> element is displayed one font size larger than
the rest of the text surrounding it.
• Example program
• Output
Smaller Text
• The content of the <small>...</small> element is displayed one font size smaller
than the rest of the text surrounding it.
• Example program
Page | 36
E-Content of
INTERNET TECHNOLOGY AND WEB DESIGN
• Output
Grouping Content
• The <div> and <span> elements allow you to group together several elements
to create sections or subsections of a page.
• For example, you might want to put all of the footnotes on a page within a <div>
element to indicate that all of the elements within that <div> element relate to the
footnotes.
• You might then attach a style to this <div> element so that they appear using a
special set of style rules.
• Example program
Page | 37
E-Content of
INTERNET TECHNOLOGY AND WEB DESIGN
• Output
• The <span> element, on the other hand, can be used to group inline elements
only.
• So, if you have a part of a sentence or paragraph which you want to group
together, you could use the <span> element as follows.
• Example program
• Output
Page | 38
E-Content of
INTERNET TECHNOLOGY AND WEB DESIGN
• These tags are commonly used with CSS to allow you to attach a style to a
section of a page.
Comment Lines
• HTML programming language has the facility to include comment lines for the
reference of the programmer.
• The comment will not appear in the web page. We include comments using the
<! ......> tag.
• The general format is,
• Example
• <! This part illustrates the product profile of the company >
Page | 39