HTML Elements

An HTML element is an individual component of an HTML document. HTML is composed of a tree of HTML nodes, such as text nodes.

The HTML tags are called HTML Elements in HTML, because they can have their own property like height, width, id, class and many more.

  • Each node can have HTML attributes specified.
  • Nodes can also have content, including other nodes and text.
  • Many HTML nodes represent semantics, or meaning.
  • An HTML element usually consists of a start tag and end tag, with the content inserted in between
<Tag_Name>content goes here...</Tag_Name>

HTML Element Example

<p> My First Paragraph </p>

Element Content - My First Paragraph

Empty HTML Elements

HTML elements with no content are called empty elements. <br> is an empty element without a closing tag. Empty elements can be "closed" in the opening tag with forward slash : <br />.

Nested HTML Elements

All HTML documents consist of nested HTML elements.

Let's understand nested form of HTML Element by using example to know how HTML Element being nested to each other.

Nested Element Example

<!DOCTYPE html>
<html>
  <body>
     <h1>My First Heading</h>
     <p>My first paragraph</p>
   </body>
</html>

Example Explained

  • 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 two other HTML elements - <h1> and <p>.
  • The <h1> element content is - My First Heading.
  • The <p> element content is - My first paragraph.

So we can say that HTML Elements are forming a tree structure, in general HTML Elements are always in nested forms to constructing a HTML document in a proper way.

Email Us: advertise@gdatamart.com

Donate Us: Support to GDATAMART

© 2023 GDATAMART.COM (All Rights Reserved)