0

So I am making a site and I have a top bar with some box shadow. I then have a description box directly underneath. So I set the z-indexes to ensure that the top bars box-shadow would go over the description box with the following css:

#topbar{
    z-index:9999 !important;
}
#description{
    margin-top:0px;
    z-index:-1 !important;
}

jsfiddle

you will notice if you change the margin-top, you can see that the shadow is being hidden underneath the description still!

why is this happening and how can I fix it?

note: neither element can have fixed or absolute positioning

4

1 回答 1

3

添加position: relative到两个元素。 z-index只影响定位元素。

更新 JSFiddle:http: //jsfiddle.net/BAW23/3/

于 2013-09-29T18:06:37.927 回答