HTML Elements


What is HTML Elements

HTML element has start tag and end tag. The content is between these two tags. This complete code is called Element. Some elements only have start tag but no end tag.

HTML Elements

Start tag and end tag

<h1>Heading</h1>

<p>Paragraphs</p>

<spen>hello world</spen>


Only start tag

<br>

<hr>

<img src="" alt="">


Nested HTML Elements


If there is any element inside the element then the inner element is considered as nested element. Suppose an <html> tag contains a <body> tag. In that case, the <body> tag is a nested element of the <html> tag.

Nested HTML Elements

Example

<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <title>Document</title>
</head>
<body>
    <div>
        <h1>Heading</h1>
        <p>Paragraphs</p>
    </div>
</body>
</html>