I still get confused about some fundamentals of CSS's display property. Consider the following simple html:
.outer {
background-color: red;
display: inline;
}
.inner {
display: inline;
}
<div class="outer">
<div class="inner">
Some Text
</div>
</div>
Then both divs have inline
display, and you see something close to:
This is what I expect, since I think of 'inline' as meaning something like a 'minimal wrap around' of whatever it contains. In this case, it happens to be wrapping an inline div that itself is minimally wrapping 'Some Text'.
However, if I now change the CSS of the inner div so that its display is now 'block', then I no longer see any red background color. But why? Firefox inspector indicates that the outer div is present, and that it has the same size as the inner div (which I'd expect given my 'minimal-wrapping' understanding), but its background-color does not show through.
Please let me know what subtle CSS rule is causing this non-intuitive behavior. Here is a codepen of the final, puzzling state.