HTML and CSS Reference
Figure 6-12. The vertical padding is still rendered on inline text elements
Examine display2.html closely (or compare Figures 6-11 and 6-12 ), and observe the following:
The background and border of the inline
<span> obscures the preceding line.
The next line is displayed over the background and border of the inline
The text in the inline
<span> wraps normally, splitting the box over multiple lines.
If you resize the browser window, the inline block is never split.
In other words, setting the display property to inline-block gives the element all the characteristics of a
block-level element, but displays it inline. You can verify this in display3.html, which adds the width , text-align ,
and vertical-align properties to the style rule applied to both <span> elements like this:
border: 1px solid #000;
As Figure 6-13 shows, the inline <span> remains unaffected, whereas the inline block is a different
width with the text centered. Its position in relation to the surrounding text has also been affected by the