阴影没有出现

use*_*585 26 css shadow css3

我试图在其中一个div中放置阴影并且它没有显示出来.这是我试图实现阴影的一个div:

#intro {
    padding: 0px;
    margin: 0px auto;
    width: 100%;
    float:inherit;
    overflow: hidden;
    height: 800px;
    position:inherit;
    background-color: #00b3e1;; 
    box-shadow: 0 0 50px rgba(0,0,0,0.8);
}
Run Code Online (Sandbox Code Playgroud)

这是URL:http://rachelchaikof.com/awareness/

Chr*_*ert 115

你无法看到阴影的原因是因为下一个div(#one)正好位于它下面,而阴影正在#one下面呈现.从#one中删除背景图像,阴影变得可见.

将其添加到#intro的CSS中以使阴影可见:

position: relative;
z-index: 10;
Run Code Online (Sandbox Code Playgroud)

如果您希望在其他文本区域上显示阴影,则还需要调整其z-index值,顶部元素(#intro)具有最高值.

  • 您接受的答案不会解决问题. (8认同)
  • 位置:亲戚为我做的。 (3认同)
  • 优秀。我不需要给出 z-index,相对位置有效!谢谢!我花了一个小时试图找出问题所在。 (3认同)
  • 极好!谢谢你的回答! (2认同)