HTML Elements
An element is the basic building block of any HTML file. It consists of starting tag, content and closing tag.
Below is the example:
1. Nested elements
It means that an element can contain another element in a nested form.
2. Void elements
These HTML elements can also be empty or "void". Void elements do not require a closing tag and are represented with a self-closing tag like <br/> or <hr/>.
3. Block and Inline elements
All the elements are divided into two types of elements:-
- Block Elements
- Inline Elements
1. Block Elements: These elements always start on a new line and take up the full width of the page, from left to right. Block-level elements include:
Element |
Description |
<h1>-<h6> |
Include all headings |
<header> |
Defines the header of the page |
<footer> |
Defines the footer of the page |
<section> |
Defines the section of the page |
<p> |
Defines the content of the page |
<form> |
Contains form elements like input, label |
2. Inline Elements: These elements do not start on a new line and their width is determined by their content. Inline-level elements are often used within block-level elements. Inline-level elements include:
Element |
Description |
<a> |
Defines a hyperlink to another page |
<span> |
Defines a section of content within a document |
<img> |
Defines an image with source attribute |
<button> |
Defines a clickable button |
<input>, <select> |
Define form elements |
<sup>, <sub> |
Used to highlight content with superscript and subscript |