HTML – Elements

An element is the basic building block of any HTML file. It consists of starting tag, content and closing tag.

<tagname>Write Content here!</tagname> 

1. Nested elements

It means that an element can contain another element in a nested form.

<p>Write Content here<a href="#">Click me !</a></p> 

2. Void elements

These HTML elements can be of empty or void as well. Void element are those which does not require any closing tag like <br/>, <hr/>

<p>Write Content <br/> here!</p> 

3. Block and inline elements

All the elements are divided into two types of elements:-

  1. Block Elements
  2. Inline Elements

1. Block elements:- These are the elements which always start with a new line and takes the full width of the page, from left to right. Following are the block-level elements:

<h1>-<h6>Include all headings
<header>Header tag to define the header of the page
<footer>Footer tag to define footer of the page
<section>Section tag to define section of the page
<p>To define the content of the page
<form>Contains form elements like input, label

2. Inline elements:- These are the elements which don’t start with a new line and take width as per the content in it. These are majorly used with other block elements. Following are the inline-level elements: 

<a>Anchor tag to link our webpage to other page
<span>Provide any content to the page
<img>Contains image with source attribute
<button>Button tag to make it navigate to some other webpage
<input>, <select>Form elements 
<sup>, <sub>To highlight content with super and subscript