HTML Blocks

In HTML every element has a default display value depending on what type of element it is. The default display value of most elements is block or inline. You can change the display property using css.

Block Level Elements:

A block level element always starts on a new line and takes up the full width available.

The <div> element is block level.

<div> This is first block level element</div>
<div> This is second block level element</div>

In the above example first div element takes the full width of the webpage and next div comes in next line.

Below are the block level tags:


Inline Elements:

In HTML inline element does not start on a new line and only takes up as much width as necessary.

<span> tag is a example of inline element.

<span>This is first inline span</span>
<span> This is second inline span</span>

In the above example both the span element will print on same line.