HTML Element

HTML Element

HTML Element: 

An HTML element usually consists of an <opening> tag and a </closing> tag, with content between the tags.
HTML elements are made up of everything from opening tags to closing tags

The structure of the HTML element:

 

enlightened Note: The structure of some HTML elements such as <br>, <hr> etc. differs from the above structure. These are called empty tags because they do not have closing tags.

 

Nested HTML Element

HTML elements can be nested. That is, there may be elements in the element.

All HTML documents are made up of nested HTML elements.

The following HTML document is made up of 6 HTML elements:

Example:

  1. <!DOCTYPE html>
  2. <html>
  3. <head>
  4.     <title>HTML element</title>
  5. </head>
  6. <body>
  7.     <h3>Document heading</h3>
  8.     <p>This is a paragraph</p>
  9. </body>
  10. </html>

 

Output:

 

Document heading


This is a paragraph

 

 

Example description:

yes Version 5 of HTML is indicated by the first line <! DOCTYPE html> in the above HTML document.

yes It starts with the opening <html> tag and ends with the closing </html>

yes The <head> element contains additional information about the document. For example Title of the document, description of the document, etc. It starts with the <head> tag and ends with the </head> tag.

yes The <title> element contains the title of the document. It starts with the <title> tag and ends with the </title> tag.

yes Here the <body> element is the content element. That is, <body> is the main part of the document.

<body>
    <h3>Document heading</h3>
    <p>This is a paragraph</p>
</body>

Description of a body part:

It starts with the <body> tag and ends with the </body> tag.
The two elements <h3> and <p> are the content elements.

<h3> refers to a heading with the element.

<h3>Document heading</h3>

It starts with the opening tag <h3> and ends with the closing tag </h3> and the content of this element is Document Heading.

<p> Element refers to a paragraph.

<p>This is a paragraph</p>

It starts with the opening tag <p> and ends with the closing tag </p> and the content of this element is: This is a paragraph.

Always use closing tags!

Example:

  1. <!DOCTYPE html>
  2. <html>
  3. <head>
  4.     <title>HTML example</title>
  5. </head>
  6. <body>
  7.     <p>This is a paragraph</p>
  8.     <p>This is another paragraph</p>
  9. </body>
  10. </html>

 

Output:

 

This is a paragraph

This is another paragraph

 

The above example works in all browsers because the closing tag in HTML5 is considered optional.

Note: It should never be relied upon. Because, if you forget to give closing tag, it may show unexpected / wrong result.

Always use lowercase letters!

HTML tags are not case sensitive. E.g.- <P> and <p> carry the same meaning.

It is not mandatory to use lowercase letters in HTML (5). But W3C recommends the use of lowercase letters and has to use lowercase letters for strict documents like XHTML.

 

Taghtml-element, The structure of the HTML element, Nested HTML Element, Example description, Description of a body part, html basic element, web element, basic web element, learn html elemrnt, basic web design, Element structure, Element basic structure, html elements list, html element attributes, html element id, html element definition, html element properties, html element properties, html element types, html element vs tag, html element tags

Thank You.............