B2. Formatting Text Using Tags
B2. Formatting Text Using Tags
Text must be attractive, easy to read, and should be short and crisp.
Text formatting options such as bold, italics, superscript, subscript, and so on must be
applied to attract the user attention.
Background color and image of the Web page can be specified using HTML.
! H1"is"the"top"level"heading"and"is"displayed"with"largest"font"size"
! H6"is"the"lowestMlevel"heading"and"is"displayed"with"smallest"font"size"
<!DOCTYPE html>
<html>
<head>
<title>Headings</title>
</head>
<body>
<h1>H1 Heading</h1>
<h2>H2 Heading</h2>
<h3>H3 Heading</h3>
<h4>H4 Heading</h4>
<h5>H5 Heading</h5>
<h6>H6 Heading</h6>
</body>
</html>
"
"
Groups a set of H1 to
H6 elements
Content format
determines the Formatting Formatted content makes
an HTML page more
appearance of the
readable and presentable
content in the browser
B element displays text in bold and is enclosed between <b> and </b> tags.
I element displays text in italics and is enclosed between <i> and </i> tags.
SMALL element makes the text appear smaller in browser and is enclosed between
<small> and </small> tags.
U element underlines a text and is enclosed between <u> and </u> tags.
<!DOCTYPE html>
<html>
<head>
<title>Formats</title>
</head>
<body>
<h2>Using HTML Formatting Elements</h2><br>
<b>This text is displayed in bold.</b><br>
<i>This text is displayed in italic.</i><br>
<u>This text is underlined.</u><br>
<small>This text is displayed smaller.</small>
</body>
</html>
"
"
DEL element encloses deleted text and is placed between <del> and </del> tags.
INS element encloses inserted text and is placed between <ins> and </ins> tags.
STRONG element emphasizes the text and is placed between <strong> and </strong>
tags.
SUB element displays a text as subscript and is enclosed between <sub> and </sub> tags.
SUP element displays a text as superscript and is enclosed between <sup> and </sup>
tags.
<!DOCTYPE html>
<html>
<head>
<title>Updating and Shifting Text</title>
</head>
<body>
<h3>Updating, Emphasizing, and Shifting Text</h3>
This is an example of <del>deleted</del> <ins>inserted
</ins> text.<br/>
The is an example of <strong>Strong</strong> text.<br/>
The is an example of <sub>subscript</sub>text.<br/>
The is an example of <sup>superscript</sup> text.<br/>
</body>
</html>
"
"
Monospaced fonts are used for programming code snippets, instruction texts, and ASCII
characters.
<pre> tag allows you to copy-paste the content along with the formatting from the
source.
Tag Description
<cite>
Used for citation
<blockquote>
“When one door closes, another opens; but we often look so long and
so regretfully upon the closed door that we do not see the one
which has opened for us.” -Alexander Graham Bell
</blockquote>"
"
"
Is a collection of
items
Displays a list of
related items
Can be organized in
sequential or
nonsequential manner
decimal 1, 2, 3…
lower-alpha a, b, c…
upper-alpha A, B, C…
upper-roman
I, II, III…
! list-style-type" property" is" used" to" specify" a" numbering" style" for" the"
ordered"list."
! It"is"the"property"of"the"style"a@ribute,"which"is"specified"with"the"<ol> tags."
<!DOCTYPE html>
<html>
<head>
<title>Features of EasyPad</title>
</head>
<body>
<h2>Features of EasyPad</h2>
<ul>
<li>Opens many files at a time</li>
<li>Unlimited undo and redo</li>
<li>Reads and writes both
Windows and Unix files</li>
</ul>
</body>
</html>
DL – Is a container element that consists of DT and DD sub elements. Specifies that the
definition list will be created using these elements.
1. Specify the DL element to indicate that you want to create a definition list.
<!DOCTYPE html>
<html>
<head>
<title>Types of Nouns</title>
</head>
<body>
<h2>Types of Nouns</h2>
<dl>
<dt><b>Common Noun:</b></dt>
<dd>It is a name of an object in general, such as
pencil, pen, paper, and so on.</dd>
<dt><b>Proper Noun:</b></dt>
<dd>It is the unique name of a person or a place.
</dd>
</dl>
</body>
</html>
Background property is a shorthand property that specifies all the background properties
in just one declaration.
!" Syntax"for"bgcolor"is:"
<body bgcolor=”color_name|hex_number|rgb_number”>
"
where,"
color_name"M"Specifies"the"background"color"with"a"color"name"(such"as"“red”)"
hex_number"M"Specifies"the"background"color"with"a"hex"code"(such"as"“#ff0000”)"
rgb_number"M"Specifies"the"background"color"with"an"rgb"code"(such"as""""""""""""
"""""""""""""""""""""""""""""""“rgb(255,0,0)”)"
©"Aptech'Ltd.'' Forma)ng"Text"using"Tags"/"Session"3"" 24"
Another way to specify a background color for a Web page is by using the
style=“background-color: color” attribute.
This attribute must be added to the style attribute of the <body> tag.
The foreground color can be specified by using the style=“color: color” attribute.
!" Example"demonstraDng"the"specificaDon"of"background"and"foreground"color"is:"
Inserts an image as
Background
the background on
Image Choose images with
lighter shades
a Web page
! The"<hgroup>"element"is"used"to"group"Dtles"and"their"subDtles."
"
! Monospaced" fonts" are" used" for" programming" code" scripts," instrucDon" texts,"
and"ASCII"characters."
"
! The"<pre>"tag"is"used"to"apply"preforma@ed"text"content"to"a"Web"page."
"
! To" define" a" long" quotaDon" or" block" quotaDon," the" <blockquote>" tag" can" be"
used."
"
! A" list" is" a" collecDon" of" items," which" might" be" organized" in" a" sequenDal" or"
nonsequenDal" manner." HTML" supports" three" types" of" lists" namely," ordered,"
unordered,"and"definiDon."
! HTML" provides" background" properDes" that" specify" the" background" color" and"
image"for"the"Web"pages.""