CSS: Put the child "under" the parent element of the window shadow insertion element?

See this script or code below:

http://jsfiddle.net/MegaMatt3/92G6X/9/

HTML:

<div id="outer">
    <div id="inner"></div>
</div>

CSS

#outer {
    border: 1px solid black;
    box-shadow: 0 0 20px rgba(0, 0, 0, 1) inset;
    height: 200px;
    position: relative;
    width: 200px;
}

#inner {
    background-color: #55A8FF;
    bottom: 0;
    height: 50px;
    left: 0;
    position: absolute;
    width: 100%;
}

If I have a parent with an insertion insertion shadow and a child inside it, the child appears on top of the window shadow. I would like the child to be “under” the box shadows, if possible. The effect will essentially show the insertion shadow at the top of the child.

I messed up the z-index but no luck. Is it possible? Any help is appreciated. Thanks.

EDIT:

, , , , div . , . , , , .

+4
3

, :

CSS

#outer {
    border: 1px solid black;
    height: 200px;
    position: relative;
    width: 200px;
    background-color: white;
}

#outer:after {
    content: "";
    box-shadow: 0 0 10px rgba(0, 0, 0, 0.5) inset;
    height: 100%;
    position: absolute;
    width: 100%;
    left: 0px;
    top: 0px;
}

#inner {
    background-color: #55A8FF;
    bottom: 0;
    height: 50px;
    left: 0;
    position: absolute;
    width: 100%;
}

+6

#inner z-.

#inner {
    background-color: #55A8FF;
    bottom: 0;
    height: 50px;
    left: 0;
    position: absolute;
    width: 100%;
    z-index: -10;
}

http://jsfiddle.net/S8Sm7/

PS: :), .

+6

<div>.

z-index, - <div>, - . <div>. .

<div id="outer">    
   <div id="inner"></div>
   <div id="newDiv"></div> // shadow moved to this div
</div>

I had a similar problem here css - window shadow covering all contained divs using absolute positioning

Example here: http://jsfiddle.net/92G6X/8/

0
source

Source: https://habr.com/ru/post/1525505/


All Articles