-->

Htmll element /w3school

HTML Element

An HTML elements usually consists of a starting tag and ending tag, with the contents inserted in the between:

<tagname>Content goes type here...</tagname>
The HTML elements is everything from the starting tag to the ending tag:

<p>My first paragraph</p>





Nested HTML Element

HTML element can be nested (element can contain elements).

All HTML documents consist of nested HTML element.

This example contain four HTML element:

Nested HTML Element

HTML element can be nested (element can contain element).

All HTML document consist of nested HTML element.

This example contains four HTML element:

   The <body> element define the document of the body.

   It has a starting tags <body> and the  ending tag </body>.

    The elements content is two other HTML element (<h1> and <p>).

Do Not Forget the Ending Tag
Some HTML element will displaying correctly, even if you forget the ending tag:

It has a starting tag <h1> and but an ending tag </h1>.

The element content is: This Is My First Heading.



The examples above work in all browser, because the closing tag is considering optional.

Never rely on this. It might produce unexpected results and/or error if you forget the ending tag.

Empty HTML Element
HTML element with no contents are called empty element.

<br> is an empty elements without a closing tag (the <br> tag defines a line break):




Empty element can be "closed" in the opening tag like that is: <br />.

HTML5 does not the require empty elements to be closed. But if you want stricter validation, or if you need to make your documents readable by XML parser, you must close all HTML element properly.

Use Lowercase Tag
HTML tag are not case sensitive: <P> mean the same as <p>.

The HTML5 standard does not the require lowercase tag, but W3school recommend lowercase in HTML, and demands lowercase for the stricter documents types like XHTML.

At W3Schools we always use lowercase tag.











No comments

Theme images by fpm. Powered by Blogger.