Table of Contents

    HTML Elements Explained: Essential Tags and Attributes

    HTML Elements Explained: Essential Tags and Attributes

    Elements gives structure to a HTML document and tells the browser how you want to present your website. Generally elements consists of a start tag, some content, and an end tag.

    Place for main content

    Let's look some basic tags-

    Start Tag Element Content End Tag
    <p> Paragraph content. </p>
    <h1> Heading content. </h1>

    So here <p> Paragraph Content</p> is an HTML element, <h1> Heading Content </h1> is another HTML element. There are some HTML elements which don't need to be closed, such as <img> , <br> , <hr> elements.

    Because of having no elements these are known as void elementsor empty elements.

    Nested HTML Elements

    HTML allowed to keep one Element inside another Element −

    
    <!DOCTYPE html>
    <html>
    <head>
       <title>Nested HTML element</title>
    </head>
    <body>
    
    <h1>This is Heading</h1>
    <p>This is Paragraph.</p>
    <b>This is bold text</b>
    
    </body>
    </html>
    
     

    Live Preview

    • In this example, the <html> element defines the whole document with start tag <html> and end tag </html> .

    • <head> element defines the head part of the document with start tag <head> and end tag </head> .

    • <title> element defines the title of this document with start tag <title> and end tag </title> .

    • <body> element defines the document body with start tag <body> and end tag </body> .

    • <body> element defines the document body with start tag <body> and end tag </body> .

    • <h1> element defines the heading with start tag <h1> and end tag </h1> .

    • <p> element defines the paragraph with start tag <p> and end tag </p> .

    • <b> element defines the bold content with start tag <b> and end tag </b> .