I had a problem with setting box-shadow
over the element that has a sibling with background, almost identical to Box-shadow over next sibling div
Solution with position: relative
and z-index
worked but I don't understand why. Could someone please explain?
#all {
width: 200px;
}
#header {
background-color: white;
height:20px;
box-shadow: 0 5px 5px red;
position: relative;
}
#body {
height:100px;
background-color: #ccc;
}
<div id="all">
<div id="header">
header
</div>
<div id="body">
</div>
</div>