我很难搞清楚自己做错了什么。当我将鼠标悬停在“联系人”上时,左侧有一个漂亮的灰色背景,蓝色边框,但是“Contact”这个词周围有一个黑色小背景,我不知道如何删除它。 / p>
ul li:hover {
background: #c7c3c3;
border-radius: 5px;
border-left: 10px solid #16c9ff;
text-transform: uppercase;
}
<!DOCTYPE html>
<head>
<link type="text/css" rel="stylesheet" href="new1.css"/>
<title>Sawdust & Splinters</title>
</head>
<body>
<div></div>
<div>
<ul>
<li>Home</li>
<li>Photography</li>
<li>Woodworking</li>
<li>About</li>
<li><a href="Contact.html">Contact</a></li>
</ul>
</div>
<div>
<img src="front2.jpg"/>
</div>
</body>
</html>
**** CSS ****
* {
background-color: black;
}
div {
max-width: 800px;
margin: 0 auto;
}
ul {
list-style: none;
}
ul li {
font-family: Maiandra GD;
font-size: 20px;
color: white;
font-weight: bold;
float: left;
margin-top: 60px;
margin-left: 30px;
padding: 10px;
}
ul li:hover {
background: #c7c3c3;
border-radius: 5px;
border-left: 10px solid #16c9ff;
text-transform: uppercase;
}
a:link {
color: white;
text-decoration: none;
}
a:visited {
text-decoration: none;
color: white;
}
div img {
max-width: 800px;
margin-top: 40px;
border-radius: 10px;
}
#ss {
font-family: Maiandra GD;
font-size: 4em;
text-align: center;
}
答案 0 :(得分:1)
更新了css
* {
background-color: black;
}
div {
max-width: 800px;
margin: 0 auto;
}
ul {
list-style: none;
}
ul li {
font-family: Maiandra GD;
font-size: 20px;
color: white;
font-weight: bold;
float: left;
margin-top: 60px;
margin-left: 30px;
padding: 10px;
border-left: 10px solid transparent;
}
ul li:hover {
background: #c7c3c3;
border-radius: 5px;
border-left: 10px solid #16c9ff;
}
ul li:hover .link {
background: #c7c3c3;
background: #c7c3c3;
border-radius: 5px;
text-transform: uppercase;
}
a:link {
color: white;
text-decoration: none;
}
a:visited {
text-decoration: none;
color: white;
}
div img {
max-width: 800px;
margin-top: 40px;
border-radius: 10px;
}
#ss {
font-family: Maiandra GD;
font-size: 4em;
text-align: center;
}
****** ****** HTML
<div></div>
<div>
<ul>
<li>Home</li>
<li>Photography</li>
<li>Woodworking</li>
<li>About</li>
<li>
<a class="link" href="Contact.html">Contact</a>
</li>
</ul>
</div>
<div><img src="front2.jpg"></div>