【发布时间】:2013-08-27 09:05:26
【问题描述】:
我在实现所有内容周围的 4px 嵌入框阴影边框时遇到了一些麻烦,让框阴影填充窗口很好(正如您将在下面的小提琴中看到的那样)但是因为我有一个固定的导航顶部,它出现在盒子阴影的上方(即使它在下方,尽管阴影会向上滚动并留下没有顶部边框的导航)。
jsFiddle:http://jsfiddle.net/neal_fletcher/WHP3M/2/
HTML:
<div class="test">
<div class="header">
<span class="header-link">LINK</span>
</div>
<div class="container">This is Content
<br/>This is Content
<br/>This is Content
<br/>This is Content
<br/>This is Content
</div>
</div>
CSS:
html {
height: 100%;
}
.header {
position: fixed;
top: 0; left: 0;
width: 100%; height: 50px;
background-color: orange;
z-index: 2;
}
.header-link {
padding: 50px;
}
.test {
min-height: 100%;
box-shadow: inset 0 0 0 4px rgba(0, 0, 0, 1.0);
-moz-box-shadow: inset 0 0 0 4px rgba(0, 0, 0, 1.0);
-webkit-box-shadow: inset 0 0 0 4px rgba(0, 0, 0, 1.0);
}
.container {
position: relative;
padding: 50px;
z-index: 1;
}
有没有办法在所有内容周围实现box-shadow,包括.header div?或者以某种方式在 div 的顶部、左侧和右侧实现 box-shadow 以给人以整个站点周围边框的印象?任何建议将不胜感激!
【问题讨论】: