LESSON.3 : HTML-ELEMENTS
An HTML element consists of starting tag and closing tag, with the content inserted in between them.Everything from start tag to end tag represents HTML Elements.
Note: HTML elements with empty content are called void elements. Empty elements do not have an end tag, such as the <br>,<img> element (which indicates a line break).
HTML Tag vs. Element:
An HTML element is defined by a starting tag. If the element contains other content, it ends with a closing tag.
For example,<h1> is starting tag of a heading and </h1> is closing tag of the same heading but <h1> This is heading content </h1> is a heading element.
Nested HTML Elements:
In HTML,It is allowed to keep one HTML element inside another HTML element. All HTML documents consist of nested HTML elements.
Above example result:
The <html> element defines the whole HTML document.It has a start tag <html> and an end tag </html>.
The element content is another HTML element ,the <body> element.The <body> element defines the document body.It has a start tag <body> and an end tag </body>.
The element content is four other HTML elements (<h1>,<p>,<i> and <u>).
The <h1> element defines a heading.It has a start tag <h1> and an end tag </h1>.The element content is: My First Heading.
The <p> element defines a paragraph.It has a start tag <p> and an end tag </p>.The element content is: My first paragraph.
The <i> element defines a italic content. It has a start tag <i> and an end tag <i/>. The element content is : This is italic heading.
The <u> element defines a Underlined content. It has a start tag <u> and an end tag <u/>. The element content is : This is underlined paragraph.
NOTE: HTML tags are not case sensitive: <P> means the same as <p>.