Free HTML tutorial

HTML Block and Inline Elements

HTML elements have different display behaviors. Block elements generally start on a new line, while inline elements flow within surrounding text. CSS can change their visual display.

Block elements

Elements such as <div>, <p> and headings are commonly displayed as blocks. They take the available line width by default and begin on a new line.

Inline elements

Elements such as <a>, <strong> and <span> usually flow with the text around them.

<p>Read the <a href="/html-tutorial/">HTML tutorial</a> to learn more.</p>

Choose elements by meaning

Use an element that communicates the content's purpose. Use <div> and <span> when no more meaningful element fits, and use CSS to control layout and display.