Skip to content
Justice Tech School

Block, Inline and Inline-block

Block elements take the full width and start a new line. Inline elements flow within text and ignore width and height. inline-block flows like inline but accepts width and height.

Example
<style>
.b { display: block; background: #134e4a } .i { display: inline; background: #78350f } .ib { display: inline-block; width: 80px; background: #1e3a8a }
</style>
<div class="b">block</div><span class="i">inline</span> <span class="ib">inline-block</span>

Exercise

Accepts width but flows inline.

display: -block;

Quiz Test

Which accepts width and height and stays inline?

These free lessons are for learning. Join a full course for projects, mentor feedback and a verified certificate.