# HTML Elements

An **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 tag | Content |
| --- | --- |
| &lt;p&gt;&lt;/p&gt; | This is paragraph content |
| &lt;h1&gt;&lt;/h1&gt; | This is heading content |
| &lt;div&gt;&lt;/div&gt; | This is division content |
| &lt;br /&gt; | This is break in HTML |

So here **&lt;p&gt;....&lt;/p&gt;** is an HTML element, **&lt;h1&gt;...&lt;/h1&gt;** is another HTML element. There are some HTML elements which don't need to be closed, such as **&lt;img.../&gt;**, **&lt;hr /&gt;** and **&lt;br /&gt;** elements. These are known as **void elements**.

HTML documents consists of a tree of these elements and they specify how HTML documents should be built, and what kind of content should be placed in what part of an HTML document.

## **HTML Tag vs. Element**

An HTML element is defined by a *starting tag*. If the element contains other content, it ends with a *closing tag*.

For example, **&lt;p&gt;** is starting tag of a paragraph and **&lt;/p&gt;** is closing tag of the same paragraph but **&lt;p&gt;This is paragraph&lt;/p&gt;** is a paragraph element.

## **Nested HTML Elements**

It is very much allowed to keep one HTML element inside another HTML element −

### Example:

```xml
<!DOCTYPE html>
<html>

   <head>
      <title>Nested Elements Example</title>
   </head>
	
   <body>
      <h1>This is <i>italic</i> heading</h1>
      <p>This is <u>underlined</u> paragraph</p>
   </body>
	
</html>
```

This will display the following result −

![](https://cdn.hashnode.com/res/hashnode/image/upload/v1673554809938/9073f1cc-6448-48c5-81f7-87bbd9b4a01f.png align="center")

---

> Thanks for reading this blog! 😊
