HTML document is made up of various elements which act as the building blocks of any web pages. These elements are divided into two categories i.e. block elements and inline elements.
A block element always starts on a new line and takes up the full available width in a HTML document, from left to right. Block elements has a line break before and after the element. Example of block elements are <div>
, <h1>
- <h6>
, <p>
, <form>
, <pre>
, <hr>
, <ol>
, <ul>
, <dl>
etc.
An inline element is the opposite to the block element, which means it does not start on a new line and only takes up necessary width in a HTML document. Inline elements has no line break before and after the element. Example of inline elements are <span>
, <a>
, <img>
, <b>
, <i>
, <u>
, <em>
etc.