Why does text on the same layer overlap - even when it has an opaque background?
问题 I know that I can stack elements in separate layers by creating new stacking contexts with relative/absolute positioning (Demo) or opacity (Demo) However I was under the impression that by default an element further down in the html will be painted above previous elements. Apparently, this is so for the element's background, but I just noticed that text works differently. So with simple markup like: <div class="div1">text1</div> <div class="div2">text2</div> The background of the 2nd div will