This's source sentence.
When this happens, floats are rendered in front of non-positioned in-flow blocks, but behind in-flow inlines.
I don' t know if my understanding is correct. So, look some examples.
behind in-flow inlines
: exist a span
and float
, float
is behind span
. I feel this is correct.
.left {
float: left;
}
.test {
background: rgba(155, 155, 155, 0.5);
margin-left: -50px;
padding: 10px;
font-size: 24px;
}
<span class="left" style="background-color: red; padding: 10px">
Some have gone and some remain
</span>
<span class="test">
In my life, I've loved them all
</span>
But, this sentence floats are rendered in front of non-positioned in-flow blocks
, it's a little weird.
float
box's background
and border
are really in front of blocks
box. But inner text isn't.
.left {
float: left;
}
.test1 {
height: 30px;
border: 1px solid red;
background: red;
margin-right: -30px;
border: 3px solid green;
font-size: 12px;
}
.test2 {
background-color: rgba(155, 155, 155, 0.5);
margin-right: -20px;
padding: 10px;
font-size: 18px;
border: 2px dashed black;
font-weight: bold;
}
<p class="left test1">
Some have gone and some remain
</p>
<p class="test2">
In my life, I've loved them all
</p>
As far as the specifications I have read so far, I don't know why, and I'm not sure if my example is correct.