Friday, 22 November 2013

Chapter 2: HTML Elements

Chapter 2: HTML Elements


HTML Elements

HTML documents are defined by HTML elements.An HTML element is everything betweent he start tag and the end tag.

OPENING TAG
HTML ELEMENT
CLOSING TAG
<a href="text.htm">
Link
</a>
<h1>
HTML Heading
</h1>
<p>
HTML Paragraph
</p>
<br />





Nested Elements

This example contains three HTML elements. The <p> element is nested in the <body> element, which in turn is nested in the <html> element.

EXAMPLE:

<html>
<body>

<p>HTML Paragraph</p>

</body>
</html>



<body> element

The <body> elememt defines the body of the web page.

EXAMPLE:

<body>

<p>HTML Paragraph</p>

</body>


<html> element

The <html> element defines the entire web page.

EXAMPLE:

<html>

<body>
<p>HTML Paragraph</p>
</body>

</html>


ATTENTION:

Don't forget the end tag. Most browsers will display HTML correctly even if you forget the end tag, but don't rely on it. But if you forget the end tag this can produce unexpected errors or results.

EXAMPLE:

<p>HTML Paragraph 1
<p>HTML Paragraph 2


Empty HTML Element

When HTML element haven't content he's called empty element. This kind of elements can be closed within the opening tag. <br> is an empty element without a closing tag. It defines a line break. The only way to close empty element is to add a slash to the end of start tag.



Lowercase tags


Most computer languages are case sensitive, but HTML is not one of them. The tag <P> means the same as <p>. Big number of web sites all over the world uses uppercase HTML tags.