我正在设计一个WP主题。我决定在标题中创建链接,因为它们在图像中。然而,我无法使蓝色渐变填充区域充满黑色背景(我使用那个花哨的渐变只是指出问题)。被称为迷人.current
类以实现这一目标,基本上是:
.current {background-color: black; color: rgb(242, 245, 238); padding-top: 65px;}
同时图片:
我做了 NOT 使用了CSS-reset,我检查了overflow
属性来封装列表的div,没有用。
HTML code:
<div id="container" class="">
<div id="header" class="shadow">
<div id="logoContainer">
<span class="helper"></span><img src="img/tdw_logo_serif.png" alt="The Digital Warehouse">
<div id="links">
<ul class="helper">
<li><span class="helper"></span>HOME</li>
<li class="current"><span class="helper"></span>BLOG</li>
<li><span class="helper"></span>PORTFOLIO</li>
<li><span class="helper"></span>CONTACT</li>
</ul>
</div>
</div>
</div>
...
</div>
CSS代码:
#container {
}
#header {
top: 0;
left: 0;
right: 0;
height: 35px;
overflow: visible;
background-color: rgb(242, 245, 238);
color: rgba(5, 0, 18, 1.00);
z-index: 100;
} .willStick {
position: absolute;
padding-top: 65px;
} .didStick {
position: fixed;
padding-top: 0;
}
#logoContainer {
position: relative;
height: 35px;
padding-left: 60px;
padding-right: 60px;
width: 900px;
margin: auto;
overflow: visible;
}
#logoContainer img {
margin: 0;
padding: 0;
height: 35px;
vertical-align: middle;
display: inline-block;
}
.helper {
display: inline-block;
height: 100%;
vertical-align: middle;
}
#links {
position: relative;
float:right;
display: inline-block;
vertical-align: middle;
margin: 0;
padding: 0;
height: 35px;
overflow: visible;
}
#links ul {
margin: 0;
padding: 0;
display: inline-block;
font-size: 0.7em;
font-weight: 800;
font-family: "jaf-bernino-sans-condensed", "proxima-nova", sans-serif;
text-transform: uppercase;
list-style-type: none;
overflow: visible;
}
#links li {
width: 90px;
height: 35px;
border: 0;
margin: 0;
padding: 0;
display: inline-block;
float: left;
text-align: center;
overflow: visible;
}
任何帮助将不胜感激。
答案 0 :(得分:2)
这似乎是一个特殊问题 - 尝试
#links li.current etc.
#container {
}
#header {
top: 0;
left: 0;
right: 0;
height: 35px;
overflow: visible;
background-color: rgb(242, 245, 238);
color: rgba(5, 0, 18, 1.00);
z-index: 100;
} .willStick {
position: absolute;
padding-top: 65px;
} .didStick {
position: fixed;
padding-top: 0;
}
#logoContainer {
position: relative;
height: 35px;
padding-left: 60px;
padding-right: 60px;
width: 900px;
margin: auto;
overflow: visible;
}
#logoContainer img {
margin: 0;
padding: 0;
height: 35px;
vertical-align: middle;
display: inline-block;
}
.helper {
display: inline-block;
height: 100%;
vertical-align: middle;
}
#links {
position: relative;
/*float:right;*/
display: inline-block;
vertical-align: bottom;
margin: 0;
padding: 0;
height: 35px;
overflow: visible;
}
#links ul {
margin: 0;
padding: 0;
display: inline-block;
font-size: 0.7em;
font-weight: 800;
font-family: "jaf-bernino-sans-condensed", "proxima-nova", sans-serif;
text-transform: uppercase;
list-style-type: none;
overflow: visible;
}
#links li {
width: 90px;
height: 35px;
border: 0;
margin: 0;
padding: 0;
display: inline-block;
float: left;
text-align: center;
overflow: visible;
}
#links li.current {background-color: black; color: rgb(242, 245, 238); padding-top: 65px;}
<div id="container" class="">
<div id="header" class="shadow">
<div id="logoContainer">
<span class="helper"></span>
<div id="links">
<ul class="helper">
<li><span class="helper"></span>HOME</li>
<li class="current"><span class="helper"></span>BLOG</li>
<li><span class="helper"></span>PORTFOLIO</li>
<li><span class="helper"></span>CONTACT</li>
</ul>
</div>
</div>
</div>
</div>