Showing posts with label HTML Elements. Show all posts
Showing posts with label HTML Elements. Show all posts

Monday, 30 June 2014

HTML Elements !!

HTML elements is everything from the start tag to the end tag.

HTML have tow type of tags, one: start tag is often is called the opening tag, and second: end tag is often called the closing tag.

HTML Element tag:
HTML element starts with a start tag or opening tag and ends with an end tag or closing tag.
The element content is everything between the start and the end tag or opening / closing tag.
Some HTML elements have empty content.
Empty elements are closed in the start tag.

HTML Element Explained:
<p>My first HTML paragraph.</p>

The <p> element:
<p>This is my first HTML paragraph.</p>
The <p> element defines a paragraph in the HTML document.
The element has a start tag <p> and an end or closing tag </p>.
The element content is: This is my first HTML paragraph.

The <body> element:
<body>
<p>This is my first HTML paragraph.</p>
</body>

<body>
<p>This is my first HTML paragraph.</p>
</body>
The <body> element defines the body of the HTML document.
The element has a start tag <body> and an end or closing tag </body>.
The element content is another HTML element (a p element).

The <html> element:

<html>
<body>
<p>This is my first HTML paragraph.</p>
</body>
</html>

The <html> element defines the whole HTML document.
The element has a start tag <html> and an end or closing tag </html>.
The element content is another HTML element (the body element).

Don't Forget the End or Closing Tag:
Some HTML elements might display correctly even if you forget the end tag:

<p>This is a HTML paragraph
The example above works in most browsers, because the closing tag is considered optional.

Never rely on this. Many HTML elements will produce unexpected results and/or errors if you forget the end tag .
[Never forget use End or Closing Tag, must use End or Closing Tag.]

Empty HTML Elements:
HTML elements with no content it's called empty elements.

<br> and <hr/> is an empty element without a closing tag (the <br> tag defines a line break and <hr/> tag defines a line border).

Tip: In XHTML, all elements must be closed. Adding a slash inside the start tag, like <br />, is the proper way of closing empty elements in XHTML.