Inline-level Elements and Inline Boxes in CSS

Inline-level elements have their CSS display property set to either ‘inline, ‘inline-table’, or ‘inline-block’ and these elements do not force a line break above and below themselves. Inline-level boxes are generated by each inline-level element which is a part of the positioning scheme as well as contains child boxes.

Inline boxes are boxes which have their content follow inline formatting context. Inline boxes are split into a number of inline boxes whilst those inline boxes that are never split are called atomic inline-level boxes.

Anonymous inline boxes are those boxes over which developer has no control. If a block box contains some bare text and other inline-level boxes, then the bare text around inline-level boxes follows inline formatting context and is enclosed in anonymous inline boxes.


Let’s see an example for Inline-level Elements and Inline Boxes −

 Live Demo

<!DOCTYPE html>
<title>CSS Inline-level Elements and Inline Boxes</title>
form {
   margin: 0 auto;
   text-align: center;
* {
   padding: 2px;
input[type="button"] {
   border-radius: 10px;
   color: white;
   border: 4px solid black;
   background-color: #FF8A00;
   background-color: #F44336;
   background-color: #C303C3;
   background-color: #4CAF50;
   background-color: #03A9F4;
   background-color: #FEDC11;
<legend>CSS Inline-level Elements and Inline Boxes</legend>
<div><span class="child">Orange</span> Color<span class="child">Red</span> Color<span class="child">Violet</span> Color</div><br>


This will produce the following output −