HTML Element

What is Element in HTML?

HTML element is defined by a starting tag.

If the element contains other content, it ends with a closing tag, where the element name is preceded by a forward slash as shown below with few tags:


HTML Elements

Start Tag Content End Tag
<html> This is html element </html>
<p> This is paragraph content </p>
<h1> This is heading content </h1>
<div> This is division content. </div>

Nested HTML Elements

All HTML documents consist of nested HTML elements.

The <html> element is the root element and it defines the HTML document.

                                                    
<!DOCTYPE html>
<html lang="en">
<head>
  <title>Hello World!</title>
</head>
<body>
  <h1>Hello World!</h1>
  <p>This is a simple "Hello World" website.</p>
</body>
</html>
                                                    
                                                

Body tag

The <body> element defines the document's body.

The <body> element includes all the contents of an HTML document, consisting of headings, paragraphs, links, tables, lists, etc.

                                                    
                                                        <!DOCTYPE html>
<html lang="en">
<head>
</head>
<body>
  <h1>Hello World!</h1>
</body>
</html>