Sunday, July 15, 2012

HTML elements

This is lesson 4 of HTML. The elements of HTML are
(the code to test all of these elements is given at the bottom)
<a> … </a>
The a (anchor) element is used to set link.
Attributes: href, name
Example: <a href="www.websitebuildingguide.blogspot.com">build website</a>

<b> … </b>
This is used to bold a text.

Attributes: none
Example: <b>this is bold text</b>


<br />
This is used to insert break after a line. It does not have end tag.
Attributes: none
Example: You have </br> you have </br> you have.


<center> … </center>
Center elements shows the content in the center of the browser.
Attributes: none
Example: <center>This text is in center</center>


<font> … </font>
Font element determines appearance of the text.
Attributes: size, color, face
Example: <font size="10" color="blue">font size 10</font>
<font size="20" color="green">font size 20</font>
<font size="32" color="red">font size 32</font>

<hr />
Horizontal rule is created across the screen. It does not have end tag.
Attributes: align, color, noshade, size, width
Example: <hr/>
<hr size="15"/>
<hr color="red"/>  

<hn> … </hn>
This used define heading of text. Here, n is a number among 1, 2, 3, 4, 5, 6.

Attributes: align
Example: <h1>This is heading 1</h1>
<h2>This is heading 2</h2>
<h5>This is heading 5</h5>

<i> … </i>
Italic element is used to display text in etalic,
Attributes: none
Example: <i>This is italic text</i>.

<img />
Image element is used to show image. It has no end tag.
Attributes: align, border, height, src, vspace, width.
Example: <img src="tulips.jpg" height="50" width="50"/>

<p> … </p>
Paragraph element is used to separate and indent paragraph.
Attributes: none
Example: (See the code at the bottom)

<u> ... </u>
Underline texts.
Attributes: none
Example: <b>This is underlined text</b>
<em> ... </em>
em element is used to mean that this portion render different emphasis from other part. It is shown in italic appearance.

Attributes: none
Example: <em>This is emphasized text</em>


<strong> ... </strong>
 strong element is used to mean that this portion render more emphasis than emphasis element and from other part. It is shown in bold appearance.
Attributes: none
Example: <strong>This is strong text</strong>

<sub> ... </sub>
This is used to subscript text.
Attributes: none
Example: Subscript<sub>4</sub>

<sup> ... </sup>
This is used to superscript text.
Attributes: none
Example: Superscript<sup>2</sup>

<marquee> ... </marquee>
Attributes: (described later)
Example: <marquee>The text is in marquee tag</marquee>


Code
 
<html>
<head>
<title>first website</title>
</head>
<body>
<a href="www.websitebuildingguide.blogspot.com">build website</a>

<b>this is bold text</b>

You have the power.
You have the power. </br> 
You have the power. </br> (br element is here) You have the power.

<center>This text is in center</center>

<font size="10" color="blue">font size 10</font>

<font size="20" color="green">font size 20</font>

<font size="32" color="red">font size 32</font>

<hr/>

<hr size="15"/>

<hr color="red"/> 

 <h1>This is heading 1</h1>

<h2>This is heading 2</h2>

<h5>This is heading 5</h5>
<i>This is italic text</i>
<img src="tulips.jpg" height="50" width="50"/>
<u>This is underlined text</u>
<em>This is emphasized text</em>
<strong>This is strong text</strong>
Subscript<sub>4</sub>
Superscript<sup>2</sup>
 <marquee>The text is in marquee tag</marquee>
</body>
</html>

No comments:

Post a Comment