Block and inline elements in HTML
Each element in HTML has a default display value, depending on which element it is. The default display value of most elements is block or inline.
Block elements
Block elements usually start at the beginning of the line and take up the full width possible (from left to right)
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
Inline element
The inline element does not start a new line and takes only the required width.
Inline Elements in HTML
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
div element
The div element is usually used to contain other HTML elements, it has no required attributes but style, class and id are common attributes. When used with CSS, the div element can be used to style the content block.
span element
The span element is usually used to contain text elements in HTML, it has no required attributes but style, class and id are common attributes. When used with CSS, the span element can be used to style the content block.