【发布时间】:2016-12-27 23:38:18
【问题描述】:
所以我有这个导航栏,我想在鼠标悬停时更改它的颜色。它的默认值为黑色,我希望它是浅灰白色。我在这里做错了什么?
HTML:
<!DOCTYPE html>
<html>
<head>
<title>Frontend</title>
</head>
<body>
<div class="container">
<div class="row">
<div class="box">
<div id="header">
<br />
<div id="searchMenu">
<input id="sweBtn" type="button" value="SVENSKA" />
<input id="engBtn" type="button" value="ENGLISH" />
<input id="searchTxt" type="text" />
<input id="searchBtn" type="button" value="SÖK" />
</div>
<br />
</div>
<div class="col-sm-4 text-left" id="imgText">
<h3>Title</h3>
<p>Paragraph</p>
</div>
<div class="col-sm-4">
<img id="imgHeader" src="~/img/Header.png" />
</div>
<div>
<ul id="navBar"> //Here is the navbar I am talking about
<li><a>BEHÖVER DU AVOKAT?</a></li>
<li><a>ADVOKATETIK</a></li>
<li><a>ATT BLI ADVOKAT</a></li>
<li><a>UTBILDNING</a></li>
<li><a>ADVOKATSSAMFUNDET TYCKER</a></li>
</ul>
</div>
</div>
</div>
</div>
<footer>
</footer>
</body>
</html>
<link href="~/Content/custom.css" rel="stylesheet" />
CSS:
ul {
list-style-type: none;
margin: 0;
padding: 0;
overflow: hidden;
background-color: #333;
}
li {
float: left;
}
li a {
display: block;
color: white;
text-align: center;
padding: 14px 16px;
text-decoration: none;
}
li a:hover {
background-color: #111;
}
#header {
background-color: #503F31;
color: white;
padding: 30px;
}
#searchMenu {
margin-left: 1450px;
}
#sweBtn {
font-family: 'Times New Roman';
background-color: Transparent;
color: grey;
}
#engBtn {
font-family: 'Times New Roman';
background-color: Transparent;
color: gold;
}
#searchTxt {
background-color: grey;
border-color: grey;
}
#searchBtn {
font-family: 'Times New Roman';
background-color: Transparent;
color: gold;
}
#imgText {
font-size: 25px;
position: absolute;
}
#imgHeader {
width: 1904px;
}
#navBar {
font-family: 'Times New Roman';
color: gold;
background-color: #503F31;
}
#footer {
background-color: grey;
color: white;
padding-bottom: -250px;
}
*::selection { /*This should handle the hover color situation right?*/
background: #cc0000;
color: #ffffff;
}
*::-moz-selection {
background: #cc0000;
color: #ffffff;
}
*::-webkit-selection {
background: #cc0000;
color: #ffffff;
}
还有一个旁注:我希望每个列表项都用这样的垂直线分隔:“|”
【问题讨论】:
-
那么你的悬停 CSS 规则在哪里?
-
*::selection { /*这应该处理悬停颜色的情况吧?*/ background: #cc0000;颜色:#ffffff; }
-
不,那是完全不同的事情。
标签: html css twitter-bootstrap colors