gpt4 book ai didi

html - 我的盒子阴影被图像覆盖

转载 作者:太空宇宙 更新时间:2023-11-03 23:26:37 24 4
gpt4 key购买 nike

如果您在这里查看 http://jsfiddle.net/nqugcutn/您会注意到标题上的框阴影被内容覆盖,内容具有图像背景。 (请原谅丢失的字体)。我怎样才能让盒子阴影出现?

/* Header */

.header {
background: linear-gradient(#ffffff, #f5f5f5);
width: 100%;
margin-top: 0;
height: 75px;
border-top: 5px solid #1379DB;
box-shadow: 1px 1px 5px #000;
z-index: 1;
}

.logoName {
color: #000;
font-family: Lobster, sans-serif;
font-size: 30px;
margin: 20px 20px;
float: left;
}

/* Content */

.container {
background-image: url(http://i.imgur.com/ScGxG2b.png);
background-size: cover;
background-color: #242424;
height: 1000px;
width: 100%;
z-index: 2;
}

提前致谢!

最佳答案

position: relative; 添加到您的 .header div 将使框阴影出现在背景图像上方。这是一个演示:

/* Header */

.header {
background: linear-gradient(#ffffff, #f5f5f5);
width: 100%;
margin-top: 0;
height: 75px;
border-top: 5px solid #1379DB;
box-shadow: 1px 1px 5px #000;
z-index: 1;
position: relative;
}
.logoName {
color: #000;
font-family: Lobster, sans-serif;
font-size: 30px;
margin: 20px 20px;
float: left;
}
.header ul {
list-style-type: none;
margin-top: 20px;
margin-right: 250px;
float: right;
}
.header ul li {
display: inline-block;
font-family: Montserrat, sans-serif;
color: #333;
font-size: 20px;
padding: 10px 10px;
}
.header ul li a {
font-family: Montserrat, sans-serif;
color: #333;
font-size: 20px;
}
.header ul li a:hover,
.header ul li a:active {
border-bottom: #1379DB solid;
color: #000;
}
.header ul li a:link {
text-decoration: none;
}
/* Content */

.container {
background-image: url(http://i.imgur.com/ScGxG2b.png);
background-size: cover;
background-color: #242424;
height: 1000px;
width: 100%;
z-index: 2;
}
<div class="header">
<h1 class="logoName">Company Name</h1>
<ul>
<li><a href="#">Home</a>
</li>
<li><a href="/showcase">Showcase</a>
</li>
<li><a href="/message">Contact Us</a>
</li>
</ul>
</div>
<div class="container">
</div>

jsFiddle demo .

关于html - 我的盒子阴影被图像覆盖,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/26696499/

24 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com