An HTML element typically includes a start tag, some content, and an end tag.
These elements define the structure and display behavior of content on a webpage.
<tagname>Content goes here...</tagname>
<h1>My First Heading</h1> <p>My first paragraph.</p>
Start Tag | Element Content | End Tag |
---|---|---|
<h1> | My First Heading | </h1> |
<p> | My first paragraph. | </p> |
<br> | None | None |
HTML elements can be nested — this means one element can contain another element.
In fact, every HTML document uses nested elements. It’s how the structure is defined.
Parent Element | Nested Element | Purpose |
---|---|---|
<html> | <body> | Holds the visible page content |
<body> | <h1> | Defines the main heading |
<body> | <p> | Defines a paragraph of text |
In HTML, elements that have no content inside them are called empty elements.
These elements do not need a closing tag and are written using a single tag.
<p>This is a paragraph.<br>This is a new line.</p>
<br> Line Break <hr> Horizontal Line <img> Image <input> Input Field <meta> Meta Information <link> External File Link
Tag | Description | Closing Tag |
---|---|---|
<br> | Line Break | None |
<hr> | Horizontal Line | None |
<img> | Image Tag | None |
<input> | Form Input Field | None |