我是css和html的新手,因为我想学习,我已经开始重新创建一个网站。我不知道自己做错了什么,但是当我将鼠标悬停在菜单按钮上时,没有任何反应,我也看不到指针光标,即使我在代码中指定了它。在此先感谢您的帮助!
@charset "utf-8";
/*
* {
outline: 1px solid red !important;
}*/
* {
-webkit-box-sizing: border-box;
-moz-box-sizing: border-box;
-ms-box-sizing: border-box;
box-sizing: border-box;
}
body {
font-family: "open sans","HelveticaNeue-Light","Helvetica Neue Light","Helvetica Neue",Helvetica,Arial,"Lucida Grande",sans-serif;
font-weight:300;
margin: 0;
padding:0;
border: 0;
font-size: 13px;
line-height: 18px;
color: #333333;
display:block;
vertical-align:baseline;
min-height: 100%;
min-width: 1200px;
position:relative;
}
.grid {
margin: 0 auto;
max-width: 1903px;
width: 100%;
padding: 0;
border: 0;
outline: 0;
position:relative;
}
.row {
width: 100%;
margin: 0px;
display: flex;
}
.col-1 {
width: 8.33%;
}
.col-2 {
width: 16.66%;
}
.col-3 {
width: 25%;
}
.col-4 {
width: 33.33%;
}
.col-5 {
width: 41.66%;
}
.col-6 {
width: 50%;
}
.col-7 {
width: 58.33%;
}
.col-8 {
width: 66.66%;
}
.col-9 {
width: 75%;
}
.col-10 {
width: 83.33%;
}
.col-11 {
width: 91.66%;
}
.col-12 {
width: 100%;
}
.header {
background-image: url(http://du1frgvkr39c.cloudfront.net/assets/landing-page/landingpage-c21ba89811cc1724fbe9abb71227cd10.jpg);
background-size: cover;
max-width: 100%;
position:relative;
height: 841px;
display:block;
}
.header::after {
content: "";
background: rgba(1, 1, 1, 0.2);
position: absolute;
top: 0;
left: 0;
right: 0;
bottom: 0;
}
/*
header > * {
z-index: 10;
}*/
.brand {
position: relative;
}
#logo {
position: absolute;
top: 20px;
left: 20px;
cursor: pointer;
box-shadow:none;
}
.navBar {
float: right;
position: absolute;
right: 0;
display: inline;
padding: 10px;
margin: 10px 0;
}
.no-btn {
color: #fff;
display:inline;
}
/*
.no-btn li {
display: inline;
float: left;
margin: 55px 0;
}*/
.no-btn a {
color: #fff;
text-decoration:none;
list-style:none;
display: inline;
margin-left: 20px;
font-weight:bold;
font-size: 14px;
}
.navBar .no-btn a:hover {
background-color: rgba(255,255,255,.5);
color: red;
cursor:pointer;
}
.signin {
color: #fff;
display: inline;
margin-left: 10px;
margin-top: 30px;
cursor: pointer;
}
.signin a {
color: #fff;
text-decoration:none;
list-style:none;
display: inline;
font-weight:bold;
font-size: 14px;
text-transform: uppercase;
border: 2px solid #fff;
border-radius: 2px;
padding: 7px 10px;
cursor:pointer;
}
.navBar .btn a:hover {
background-color: #FFF;
color: #333;
cursor: pointer;
}

<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml" lang="eng">
<head >
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<title>The Travel Bucket List Community — BucketListly</title>
<link type="text/css" rel="stylesheet" href="stylesheet.css"/>
<link rel="stylesheet" href="font-awesome-4.5.0/css/font-awesome.min.css"/>
</head>
<body>
<div class="grid">
<div class="header">
<div class="row">
<div class="col-1">
<div class="brand">
<a href="http://www.bucketlistly.com/" id="logo">
<img alt="Logo Icon White" src="img/logo-icon-white-2bae76747b5ea1996d4ec47a93e92ee1.png"/>
</a>
</div>
<div class="col-4">
<div class="navBar">
<ul>
<li class="no-btn"><a href="/about" title="About">About</a></li>
<li class="no-btn"><a href="/faq" title="FAQ">FAQ</a></li>
<li class="no-btn"><a href="/blog" title="Blog">Blog</a></li>
<li class="signin"><a href="/categories" class="btn" title="Ideas"><i class="fa fa-search"></i>
<span>Bucket List Ideas</span></a></li>
<li class="signin"><a href="/signin" title="Sign in">Sign in</a></li>
</ul>
</div>
</div>
</div>
</div>
</div>
</div>
</body>
</html>
&#13;
答案 0 :(得分:1)
使用之前而不是之后:
@charset "utf-8";
/*
* {
outline: 1px solid red !important;
}*/
* {
-webkit-box-sizing: border-box;
-moz-box-sizing: border-box;
-ms-box-sizing: border-box;
box-sizing: border-box;
}
body {
font-family: "open sans","HelveticaNeue-Light","Helvetica Neue Light","Helvetica Neue",Helvetica,Arial,"Lucida Grande",sans-serif;
font-weight:300;
margin: 0;
padding:0;
border: 0;
font-size: 13px;
line-height: 18px;
color: #333333;
display:block;
vertical-align:baseline;
min-height: 100%;
min-width: 1200px;
position:relative;
}
.grid {
margin: 0 auto;
max-width: 1903px;
width: 100%;
padding: 0;
border: 0;
outline: 0;
position:relative;
}
.row {
width: 100%;
margin: 0px;
display: flex;
}
.col-1 {
width: 8.33%;
}
.col-2 {
width: 16.66%;
}
.col-3 {
width: 25%;
}
.col-4 {
width: 33.33%;
}
.col-5 {
width: 41.66%;
}
.col-6 {
width: 50%;
}
.col-7 {
width: 58.33%;
}
.col-8 {
width: 66.66%;
}
.col-9 {
width: 75%;
}
.col-10 {
width: 83.33%;
}
.col-11 {
width: 91.66%;
}
.col-12 {
width: 100%;
}
.header {
background-image: url(http://du1frgvkr39c.cloudfront.net/assets/landing-page/landingpage-c21ba89811cc1724fbe9abb71227cd10.jpg);
background-size: cover;
max-width: 100%;
position:relative;
height: 841px;
display:block;
}
.header::before {
content: "";
background: rgba(1, 1, 1, 0.2);
position: absolute;
top: 0;
left: 0;
right: 0;
bottom: 0;
}
/*
header > * {
z-index: 10;
}*/
.brand {
position: relative;
}
#logo {
position: absolute;
top: 20px;
left: 20px;
cursor: pointer;
box-shadow:none;
}
.navBar {
float: right;
position: absolute;
right: 0;
display: inline;
padding: 10px;
margin: 10px 0;
}
.no-btn {
color: #fff;
display:inline;
}
/*
.no-btn li {
display: inline;
float: left;
margin: 55px 0;
}*/
.no-btn a {
color: #fff;
text-decoration:none;
list-style:none;
display: inline;
margin-left: 20px;
font-weight:bold;
font-size: 14px;
}
.navBar .no-btn a:hover {
background-color: rgba(255,255,255,.5);
color: red;
cursor:pointer;
}
.signin {
color: #fff;
display: inline;
margin-left: 10px;
margin-top: 30px;
cursor: pointer;
}
.signin a {
color: #fff;
text-decoration:none;
list-style:none;
display: inline;
font-weight:bold;
font-size: 14px;
text-transform: uppercase;
border: 2px solid #fff;
border-radius: 2px;
padding: 7px 10px;
cursor:pointer;
}
.navBar .btn a:hover {
background-color: #FFF;
color: #333;
cursor: pointer;
}
&#13;
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml" lang="eng">
<head >
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<title>The Travel Bucket List Community — BucketListly</title>
<link type="text/css" rel="stylesheet" href="stylesheet.css"/>
<link rel="stylesheet" href="font-awesome-4.5.0/css/font-awesome.min.css"/>
</head>
<body>
<div class="grid">
<div class="header">
<div class="row">
<div class="col-1">
<div class="brand">
<a href="http://www.bucketlistly.com/" id="logo">
<img alt="Logo Icon White" src="img/logo-icon-white-2bae76747b5ea1996d4ec47a93e92ee1.png"/>
</a>
</div>
<div class="col-4">
<div class="navBar">
<ul>
<li class="no-btn"><a href="/about" title="About">About</a></li>
<li class="no-btn"><a href="/faq" title="FAQ">FAQ</a></li>
<li class="no-btn"><a href="/blog" title="Blog">Blog</a></li>
<li class="signin"><a href="/categories" class="btn" title="Ideas"><i class="fa fa-search"></i>
<span>Bucket List Ideas</span></a></li>
<li class="signin"><a href="/signin" title="Sign in">Sign in</a></li>
</ul>
</div>
</div>
</div>
</div>
</div>
</div>
</body>
</html>
&#13;
答案 1 :(得分:0)
试试这个
.navBar ul li a:hover {
background-color: #FFF;
color: #333;
cursor: pointer;
}