Html2
attention.jpeg this page needs proper formatting of the content

Tags

Tags are the reserve keywords used in the HTML file. With the help of tags we can set the format of the text and elements used in the file.

Example: Setting the font, size, color, bold, italic, Underline to the text.

In HTML language all of the files are written using tags. Even starting of the html file is done by the <html> tag and ended with the </html> end tag. Tags are the reserved keywords used in the HTML. They are the predefined words called tags.

features

· HTML tags are used to mark-up HTML elements.

· HTML tags are surrounded by the two characters <and>

· The surrounding characters are called angle brackets.

· HTML tags normally come in pairs like <b> and </b>

· The first tag in a pair is the start tag, the second tag is the end tag.

· The text between the start and end tags is the element content.

· HTML tags are not case sensitive, <b> means the same as <B>

Basic HTML Tags

The most important tags in HTML are tags that define headings, paragraphs, body and line breaks. The basic HTML Tags are described here in the form of table so that you can remind them easily.

Tag Description
<html> Defines an HTML document
<head> Defines information about the document
<title> Defines the document title
<body> Defines the document's body
<h1> to <h6> Defines header 1 to header 6
<p> Defines a paragraph
<br> Inserts a single line break
<hr> Defines a horizontal rule
<!—> Defines a comment

<head>

The head tag defines information about the document. The browser does not display the "head information" to the user. The following tags can be in the head section: <base>, <link>, <meta>, <script>, <style>, and <title>. The head tag is used between <html> and <body> tags.

<title> tag

Title tag defines the title of the document which appears in the Title bar of the explorer window. Title tag is used in between <head> and </head> tag because it is title tag is section of <head> tag.

<body> tag

The body element defines the document's body. It contains all the contents of the document (like text, images, colors, graphics etc).
Example:
<body bgcolor ="red" background="c:\img\sky.jpg" links="blue" text="black">

<p>…..</p> Paragraph Tag

This tag is used for creating the paragraph in the web page. It is used inside the body of file.
In this tag align attribute can be used.

<hr> tag

The <hr> tag inserts a horizontal rule. The <hr> tag has no end tag.

Format:
text……<hr> ……text or text……<hr align=" " size=" " width=" ">…. text
Attribute

Attribute Value Description
align right,left,center The alignment of the horizontal rule.
size % , pixels The thickness (height) of the horizontal rule.
width % , pixels The width of the horizontal rule.

Character Format Tags

These tags are used for the formatting of the text such as underline, bold, italic, font, size, color of the text.

All these character formatting Tags are defined in the table shown below:

Char Format Tag Description
<b> Displays bold text
<i> Displays italic text
<tt> Renders as teletype or mono spaced text
<u> Displays underlined text
<em> Displays emphasized text
<big> Displays big text
<small> Displays small text
<strong> Displays strong text
<sub> Displays subscripted text
<sup> Displays superscripted text
<bdo> Defines the direction of text display
<font> Defines the font face, size, and color of text

<tt> Tag

The <tt> tag displays the typewriter text.

<em> Tag

The <em> tag displays the emphasized text.

<strong> Tag

The <strong> tag displays strong text.

<bdo> Tag

The <bdo> tag defines the direction of the text.

Format:
<bdo> …………….text………</bdo>

<font> Tag

The <font> tag defines the font, color, size of the text.

Format:
<font face="font_name" color="color_name" size="number">……..text………</font>

Examples of the Text Formatting tags

Examples Outputs
<b>This text is bold</b> This text is bold
<strong> This text is strong </strong> This text is strong
<big> This text is big </big> This text is big
<em> This text is emphasized </em> This text is emphasized
<i> This text is italic </i> This text is italic
<small> This text is small </small> This text is small;
This text contains <sub> subscript </sub> This text contains subscript
This text contains <sup> superscript </sup> This text contains superscript
<u> this is underlined text </u> this is underlined text
<bdo dir="rtl">Here is some Hebrew text</bdo> Here is some Hebrew text

You have read all the basic tags, So now lets do some practical.

Just write/copy this example on any text editor new file and save the file and open in the browser and see how it looks.

Example:
<html>
<body>
<b>This text is bold</b>
<br>
<strong> This text is strong </strong>
<br>
<big> This text is big </big>
<br>
<em> This text is emphasized </em>
<br>
<i> This text is italic </i>
<br>
<small> This text is small </small>
<br>
<u> this is underlined text </u>
<br>
This text contains
<sub> subscript </sub>
<br>
This text contains
<sup> superscript </sup>
<br> The use of font tag
<font face="arial" size="3" color="green">
this is use of font tag</font>
</body>
</html>

Output Tags

These tags are often used to display computer/programming code. You might be surprised for "how to display the text containing the spaces, line breaks, programming codes, sample text, define variable". Do not worry, because in this chapter we are going to show you how easily you can do easily.

So lets start with these tags:

Tag Description
<pre> Defines preformatted text
<code> Defines computer code text
<tt> Defines teletype text
<kbd> Defines keyboard text
<var> Defines a variable
<dfn> Defines a definition term
<bdo> Defines the direction of text display
<samp> Defines sample computer code

<pre>………</pre>Tag
This is preformatted text. It preserves both spaces and line breaks. The pre tag is good for displaying computer code.

Format:
<pre> …..text…..</pre>

Example:
<pre> for i = 1 to 10
print i
next i
</pre>

Output:
for i = 1 to 10
print i
next i

<code> …..text ……</code> Tag
This tag is also used to display the computer code. But better you use <pre> tag.

Format:
<code> …..text…..</code>

<kbd>…..Keyboard Input……</kbd> Tag
This tag displays the Keyboard Input.

Format:
<kbd> …….. Keyboard Input……</kbd>

<tt>……text….</tt> Tag
This tag displays the typewriter text.

Format:
<tt> …..text…..</tt>

<samp>….sample text…</samp> Tag
This tag displays the sample text.

Format:
<samp> …..sample text…..</samp>

<var> computer variable </var>
This tag defines the computer variable.

Format:
<var> computer variable </var>

<dfn> definition term </dfn>
this tag is used for definition term.

Examples of output tags

Examples Outputs
<pre> It preserve all spaces </pre> It preserve all spaces
<code>Computer code</code> Computer code
<kbd>Keyboard input</kbd> Keyboard input
<tt>Teletype text</tt> Teletype text
<samp>Sample text</samp> Sample text
<var>Computer variable</var> Computer variable
<dfn>Definition term</dfn> Definition term

Now you have learned the Output Tags so lets do some practical. Below there is a file type the same code on notepad (any text editor) and save it. now open this file in the internet browser.

Example:
<html>
<body> <code>Computer code</code>
<br>
<kbd>Keyboard input</kbd>
<br>
<tt>Teletype text</tt>
<br>
<samp>Sample text</samp>
<br>
<var>Computer variable</var>
<br>
<p>
<b>Note:</b>
These tags are often used to display computer/programming code.
</p>
</body>
</html>

Block Tags

Tag Description
<acronym> Defines an acronym
<abbr> Defines an abbreviation
<address> Defines an address element
<blockquote> Defines an long quotation
<center> Defines centered text
<q> Defines a short quotation
<cite> Defines a citation
<ins> Defines inserted text
<del> Defines deleted text
<s> Defines strikethrough text
<strike> Defines strikethrough text

<acronym>..text..</acronym>Tag
The tag defines the start of an acronym, like "WWW" and "C.B.I.". By marking up acronyms you can give useful information to browsers, spell checkers, translation systems and search-engine indexers.

The title attribute can be used to show the full version of the expression when you are holding the mouse over the acronym(text).

Format:
<acronym title="text_to_display_when_mouse_over_the_text">..text..</acronym>

<abbr>..text..</abbr>
Indicates an abbreviated form, like "Inc.", "etc.". By marking up abbreviations you can give useful information to browsers, spell checkers, translation systems and search-engine indexers.

In some browsers the title attribute can be used to show the full version of the expression when you are holding the mouse over the abbreviation.

Format:
<abbr title="text_to_display_when_mouse_over_the_text">..text..</abbr>

<address> ..address..</address>
The <address> tag defines the start of an address. You should use it to define addresses, signatures, or authorships of documents. The address usually renders in italic. Most browsers will add a line break before and after the address element, but line breaks inside the text you have to insert yourself.

Format with Example:
<address>
Donald Duck<br />
Box 555<br />
Disneyland
</address>

Output:
Donald Duck
Box 555
Disneyland

<blockquote>………Text……..</blockquote>
The <blockquote> tag defines the start of a long quotation.

<blockquote>
<p>here is a long quotation</p>
</blockquote>

<center>….</center>
This tag Centers its enclosed text horizontally.

Format:
<center>… text …….</center>

<q> small text</q>
The <q> tag defines the start of a short quotation.

Format:
<q> small text</q>

<cite>
This tag defines the citation.

Format:
<cite> text </cite>

<ins>
This tag provide the facility of inserting the text in between the text.

Format:
<ins> text </ins>

<del>
Defines text that has been deleted in a document.

Format:
<del>..text..</del>

<s>or<strike>
The <s> and <strike> tags defines strikethrough text.

Format:
<s> text </s> or <strike> text</strike>

Examples of Block tags

Examples Outputs
<blockquote><p>here is a long quotation </p></blockquote> here is a long quotation
<q>here is a short quotation </q> "here is a short quotation"
<center>Center this text</center> Center this text
a dozen is <del>20</del>pieces! a dozen is 20 pieces!
a dozen is <ins>12</ins>pieces! a dozen is 12 pieces!
<cite>Citation</cite> Citation
A version is <s>not available.</s> now available! A version is not available. now available!
A version is <strike>not available.</strike> ok! A version is not available. ok!

Now you have learned the Output Tags, so now lets do some practical.

Just write/copy this example on any text editor new file and save the file and open in the browser and see how it looks.

Example:
<html>
<head>
<title>Block Tags</title>
</head>
<body>
<br><b> center tag </b>
<center>Center this text</center>
<b> acronym tag </b>
<acronym title="World Wide Web">WWW</acronym><br>
<b> abbr tag </b>
<abbr title="hypertext markup language"> HTML</abbr><br>
<b> blockquote tag </b>
<blockquote>here is a long quotation here is a long quotation</blockquote>
<b> del tag </b>
a dozen is <del>20</del> pieces!<br>
<b> ins tag </b>
a dozen is <ins>12</ins> pieces!<br>
<b> s tag </b>
A new version is <s>not yet available.</s> now available!
<b> strike tag </b><br>
A new version is <strike>not yet available.</strike> now available!
</body>
</html>

Other Tags

The <style> tag
The <style> tag defines a style in a document.

The style element goes in the head section. If you want to include a style sheet in your page, you should define the style sheet externally, and link to it using <link>. Using this tag you can initialize the text properties as shown in the example. In the example color for the header tag is defined initially in the header part of the file using the <style> tag.

Format Example Output
<head>
<style type="text/css">
h1 {color: yellow}
h3 {color: lightgreen}
</style>
</head> <html>
<head>
<style type="text/css">
h3 {color: red}
h4 {color: blue}
</style>
<title>style tag</title>
</head>
<body>
<h3>This is header < h3> </h3>
<h4>This is header < h4> </h4>
</body>
</html>
This is header < h3>
This is header < h4>

In the above example, h3 is a tag which will be displayed in red color which has been mentioned in the style tag. Just like h3 tag there is a tag i.e., h4 which will be displayed in the blue color which has been mentioned in the style sheet.

Attributes

Attribute Value Description
type text/css Defines the content-type

Just write/copy this example on any text editor new file and save the file and open in the browser and see how it looks.

The <div> tag
The
tag defines a division/section in a document. Use the <div> tag to group block-elements to format them with styles. This tag is used below the <body> tag.

Format Example Output
<body>
<div style=" " > </div>
</body> <html>
<body>
This is some text
<div style="color:red">
<h4>This is a header in a div section</h4>
<p>This is a paragraph in a div section</p>
</div>
</body>
</html> This is some text

This is a header in a div section
This is a paragraph in a div section

Attributes
Attribute Value Description
align left, right, top, bottom How to align the text in the div element. better use style attribute.

Now lets have an example of both the tag.
Just write/copy this example on any text editor new file and save the file and open in the browser and see how it looks.

Example:
<html>
<head>
<style type="text/css">
h1 {color: red}
h3 {color: blue}
</style>
<title>style tag</title>
</head> <body>
Use of STYLE tag
<h1>This is header H1 text </h1>
<h3>This is header H3 text </h3>
Use of DIV tag
<div style="color:#FF0000;">
This is a header in a div section
<br>This is a paragraph in a div section
</div><br>
</body>
</html>

Page in browser will Look Like:

In the above example we have seen the use of <style> and <div> tags. the both the headers h1 & h3 are displayed in the Red and Blue color because their color has been defined in the style tags. Then we saw the use of <div> tag, so the text defined in the <div> tag in displayed in the color defined inside the <div> tag.

Click here! to see the Animated Presentation of how to create the above web page.

Marquee Text with <marquee> Tags
This tag is used to to get a moving text. As on the television you see the moving news headlines. You can do this by using the <marquee> tag.

Format:
<marquee> Write the text to be scrolled </marquee>

Example:
<marquee> Write the text to be scrolled </marquee>

Attributes

Attribute Value Description
bgcolor colorcode,colorname Defines the back ground color to the text.
behavior alternet, slide Defines the type of movement to the text.
direction down, up, right, left Defines the movement direction of the text.
loop positive integer Defines the no. of times to text will scroll.
scrollamount positive integer Defines the scrolling speed of the text.
title text Defines text will appear when mouse pointer is on it.
width, height positive integer Defines the area of scrolling.

Behavior attribute
alternet: for this value the text bounces across the scroll region.
slide: for this value the text slides into position.

if you do not defines the behavior attribute then the text keeps scrolling continues manner according to the direction. BLINKING TEXT with <blink>Tag

This blinking text is the text which blinks like a bulb with on/off system. This blinking of text can be achieved in the HTML using the <blink> Tag.

Format :
<blink> write the text to blink </blink>

Example:
<blink> This is the blinking text. </blink> so now lets do some practical.

Just write/copy this example on any text editor new file and save the file and open in the browser and see how it looks.

Example:
<html>
<head>
<title>Marquee & Blink </title>
</head>
<body>
<b>Marquee text with <br>
direction=up height=50 width=200 scrollamount=1 bgcolor=lightyellow </b>
<br>
<marquee style="color: #FF0000; font-size: 12pt; font-weight: bold; font-family: Verdana" direction="up" height="50" width="200" scrollamount="1" bgcolor="lightyellow"> this is scrolling text</marquee></p>
<p><b>Marquee text with <br>
direction=left height=20 behavior=alternate scrollamount=10 bgcolor=lightyellow </b>
<marquee style="color: #FF0000; font-size: 12pt; font-weight: bold; font-family: Verdana" direction="left" height="20" behavior="alternate" scrollamount="10" bgcolor="lightyellow"> this is scrolling text</marquee><br>
<br>
<b>Marquee text with <br>
direction=left height=20 scrollamount=10 bgcolor=lightyellow </b>
<marquee style="color: #FF0000; font-size: 12pt; font-weight: bold; font-family: Verdana" direction="left" height="20" scrollamount="10" bgcolor="lightyellow"> this is scrolling text</marquee><br>
<br>
<font face="Verdana">
<b>BLINKING TEXT</b></font></p>
</p>
<font color="#FF0000"><b>
<BLINK> <font face="Verdana">This is the blinking text.</BLINK></b></font>
</body>
</html>

In the above example we have used both the <marquee> & <blink> tags and output is shown. In case of <blink> tag it might happen that the text displayed in <blink> tag do not appears to be blinking. It is all because the Internet Explorer do not support the blinking text where as the Netscape Navigator supports.

Tags Summary

Tags Ordered Alphabetically

Tags Description
<!> Defines a comment
<a> Defines an anchor
<abbr> Defines an abbreviation
<acronym> Defines an acronym
<address> Defines an address element
<area> Defines an area inside an image map
<b> Defines bold text
<bdo> Defines the direction of text display
<big> Defines big text
<blink> Defines the blinking text in a document
<blockquote> Defines a long quotation
<body> Defines the body element
<br> Inserts a single line break
<button> Defines a push button
<caption> Defines a table caption
<center> Deprecated. Defines centered text
<cite> Defines a citation
<code> Defines computer code text
<col> Defines attributes for table columns
<colgroup> Defines groups of table columns
<dd> Defines a definition description
<del> Defines deleted text
<dir> Deprecated. Defines a directory list
<dfn> Defines a definition term
<div> Defines a section in a document
<dl> Defines a definition list
<dt> Defines a definition term
<em> Defines emphasized text
<frameset> Defines a fieldset
<font> Deprecated. Defines the font face, size, and color of text
<form> Defines a form
<frame> Defines a sub window (a frame)
<fieldset> Defines a set of frames
<h1> to <h6> Defines header 1 to header 6
<head> Defines information about the document
<hr> Defines a horizontal rule
<html> Defines an html document
<i> Defines italic text
<iframe> Defines an inline sub window (frame)
<img> Defines an image
<input> Defines an input field
<ins> Defines inserted text
<kbd> Defines keyboard text
<label> Defines a label for a form control
<li> Defines a list item
<map> Defines an image map
<marquee> Defines the moving text in a document
<menu> Deprecated. Defines a menu list
<noframes> Defines a noframe section
<ol> Defines an ordered list
<optgroup> Defines an option group
<option> Defines an option in a drop-down list
<p> Defines a paragraph
<pre> Defines preformatted text
<q> Defines a short quotation
<s> Deprecated. Defines strikethrough text
<samp> Defines sample computer code
<select> Defines a selectable list
<small> Defines small text
<span> Defines a section in a document
<strike> Deprecated. Defines strikethrough text
<strong> Defines strong text
<style> Defines a style definition
<sub> Defines subscripted text
<sup> Defines superscripted text
<table> Defines a table
<tbody> Defines a table body
<td> Defines a table cell
<textarea> Defines a text area
<tfoot> Defines a table footer
<th> Defines a table header
<thead> Defines a table header
<title> Defines the document title
<tr> Defines a table row
<tt> Defines teletype text
<u> Deprecated. Defines underlined text;
<ul> Defines an unordered list
<var> Defines a variable

Tags Ordered by Function
Basic Tags

Tags Description
<html> Defines a html document
<head> Defines information about the document
<title> Defines the document title
<body> Defines the body element
<h1> to <h6> Defines header 1 to header 6
<p> Defines a paragraph
<br> Inserts a single line break
<hr> Defines a horizontal rule
<!> Defines a comment

Char Format

Tags Description
<b> Defines bold text
<font> Deprecated. Defines the font face, size, and color of text
<i> Defines italic text
<em> Defines emphasized text
<big> Defines big text
<strong> Defines strong text
<small> Defines small text
<sup> Defines superscripted text
<sub> Defines subscripted text
<bdo> Defines the direction of text display
<u> Deprecated. Defines underlined text

Output

Tags Description
<b> <pre> Defines preformatted text
<font> <code> Defines computer code text
<i> <tt> Defines teletype text
<em> <kbd> Defines keyboard text
<big> <var> Defines a variable
<strong> <dfn> Defines a definition term
<small> <samp> Defines sample computer code

Blocks

Tags Description
<acronym> Defines an acronym
<abbr> Defines an abbreviation
<address> Defines an address element
<blockquote> Defines an long quotation
<center> Deprecated. Defines centered text
<q> Defines a short quotation
<cite> Defines a citation
<ins> Defines inserted text
<del> Defines deleted text
<s> Deprecated. Defines strikethrough text
<strike> Deprecated. Defines strikethrough text

Links

Tags Description
<a> Defines an anchor

Frames

Tags Description
<frame> Defines a sub window (a frame)
<frameset> Defines a set of frames
<noframes> Defines a noframe section
<iframe> Defines an inline sub window (frame)

Input

Tags Description
<form> Defines a form
<input> Defines an input field
<textarea> Defines a text area
<button> Defines a push button
<select> Defines a selectable list
<optgroup> Defines an option group
<option> Defines an item in a list box
<label> Defines a label for a form control
<fieldset> Defines a fieldset

Lists

Tags Description
<form> <ul> Defines an unordered list
<input> <ol> Defines an ordered list
<textarea> <li> Defines a list item
<button> <dir> Deprecated. Defines a directory list
<select> <dl> Defines a definition list
<optgroup> <dt> Defines a definition term
<option> <dd> Defines a definition description
<label> <menu> Deprecated. Defines a menu list

Images

Tags Description
<img> Defines an image
<map> Defines an image map
<area> Defines an area inside an image map

Tables

Tags Description
<table> Defines a table
<caption> Defines a table caption
<th> Defines a table header
<tr> Defines a table row
<td> Defines a table cell
<thead> Defines a table header
<tbody> Defines a table body
<tfoot> Defines a table footer

Styles

Tags Description
<style> Defines a style definition
<div> Defines a section in a document
<marquee> Defines the moving text in a document
<blink> Defines the blinking text in a document

Programming

Tags Description
<script> Defines a script
<noscript> Defines a noscript section
<applet> Deprecated. Defines an applet
<object> Defines an embedded object
<param> Defines a parameter for an object

Unless otherwise stated, the content of this page is licensed under Creative Commons Attribution-Share Alike 2.5 License.