Block and Inline Elements
Block elements (div, p, h1, ul) start on a new line and take the full width available. Inline elements (span, a, strong, img) sit inside a line of text and only take the width they need.
You can change this with the CSS display property, for example display: inline-block or display: none.
Example
<style>
div { background: #dcfce7; margin-bottom: 6px; }
span { background: #fef9c3; }
</style>
<div>A block takes the full row.</div>
<div>Another block.</div>
<p>Inline items <span>stay</span> <span>on one line</span>.</p>Exercise
Which value makes an element inline?
div { display: ; }
Quiz Test
These free lessons are for learning. Join a full course for projects, mentor feedback and a verified certificate.