Inline vs Block
- The whole HTML elements are divided into 2 catorigies they are blcok level elements and inline elements
- Every HTML element has a default display value, depending upon what type of element it is
- All HTML tags have specific display behavior: they are either block-level elements or inline elements.
Block elements |
Inline elements |
Takes up the full width available |
Takes up only necessary width |
Always starts from new line |
Does not start from new line |
Example : |
Example: |
<h1> <p> <div> |
<a> <img> <span> |

<div> Element
<div>
tag is often used as a container for other HTML elements with CSS to style
- It is a block element
- also called as content division element
<div>
<a href="<https://www.google.com>" target="_blank">Google</a>
<a href="<https://www.facebook.com>" target="_blank">Facebook</a>
</div>
<a href="<https://www.instagram.com>" target="_blank">Instagram</a>
<span> Element
<span>
tag is also a generic container used to hold other HTML elements or group elements together
- It is an inline element
- used to style a specific line using CSS
<span>
<a href="<https://www.google.com>" target="_blank">Google</a>
<a href="<https://www.facebook.com>" target="_blank">Facebook</a>
</span>
<a href="<https://www.instagram.com>" target="_blank">Instagram</a>