老师检查一下,导航小图标不显示
来源:5-2 项目作业
DB1时间的玫瑰
2021-07-20 09:41:15
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<meta http-equiv="X-UA-Compatible" content="IE=edge">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<title>慕家居</title>
<meta name="description" content="慕家居,触手可及的家居风格!!">
<meta name="keywords" content="慕家居,简洁,自然,人性化,北欧简约风!!!">
<style>
body {
font-family: Helvetica;;
}
.center-wrap {
width: 1200px;
margin: 0 auto;
}
.clearfix {
overflow: hidden;
}
/* top区域 */
.top {
height: 40px;
background-color: #0058AA;
}
.top .topbar {
min-width: 1200px;
height: 40px;
line-height: 40px;
color: white;
font-size: 18px;
}
.top .topbar p {
float: right;
}
/* header区域 */
.header {
height: 121px;
/* 子绝父相 */
position: relative;
}
/* logo */
.header .logo {
float: left;
width: 192px;
height: 91px;
font-size: 64px;
color: #0058AA;
line-height: 91px;
}
.header .logo h1 {
float: left;
width: 192px;
height: 91px;
background: url(../images/慕家居.png);
background-size: cover;
/* 将段首缩进这个属性设置为负数,可以用这个方法隐藏文字 */
text-indent: -999em;
/* 设置触碰时候的鼠标的样式 */
cursor: pointer;
}
/* 导航 */
.header nav {
width: 736px;
height: 91px;
padding-left: 290px;
}
.header nav ul {
float: left;
}
.header nav ul li {
float: left;
padding-right: 61px;
}
.header nav ul li:last-child {
padding-right: 0;
}
.header nav ul li a span:first-child {
width: 33px;
height: 33px;
margin: 10px auto;
padding: 8px;
/* 设置圆角 */
border-radius: 50%;
}
.header nav ul li a span:first-child:hover{
background: #0058AA;
animation: r .3s ease infinite;
}
/* 动画效果 */
@keyframes r {
0% {
transform: scale(1.0);
}
50% {
transform: scale(1.05);
}
100% {
transform: scale(1.0);
}
}
.header nav ul li span.home-gry {
background: url(../images/home-gry.png) center center no-repeat;
}
.header nav ul li span.home-gry:hover {
background: url(../images/home-white.png) center center no-repeat;
}
.header nav ul li span.abouts-gry {
background: url(../images/abouts-gry.png) center center no-repeat;
}
.header nav ul li span.abouts-gry:hover {
background: url(../images/abouts-white.png) center center no-repeat;
}
.header nav ul li span.kefu-gry {
background: url(../images/kefu-gry.png) center center no-repeat;
}
.header nav ul li span.kefu-gry:hover {
background: url(../images/kefu-white.png) center center no-repeat;
}
.header nav ul li span.chanpin-gry {
background: url(../images/chanpin-gry.png) center center no-repeat;
}
.header nav ul li span.chanpin-gry:hover {
background: url(../images/chanpin-white.png) center center no-repeat;
}
.header nav ul li span.fuwu-gry {
background: url(../images/fuwu-gry.png) center center no-repeat;
}
.header nav ul li span.fuwu-gry:hover {
background: url(../images/fuwu-white.png) center center no-repeat;
}
.header nav ul li span {
display: block;
text-align: center;
font-size: 16px;
color: #545454;
}
</style>
</head>
<body>
<!-- top区域 -->
<section class="top">
<div class="topbar">
<div class="center-wrap">
<p>服务热线:400-8888-888</p>
</div>
</div>
</section>
<!-- header区域 -->
<section class="header center-wrap clearfix">
<!-- logo -->
<div class="logo">
<h1>慕家居</h1>
</div>
<!-- 导航栏 -->
<nav>
<ul>
<li>
<a href="">
<span class="home-gry"></span>
<span>网站首页</span>
</a>
</li>
<li>
<a href="">
<span class="aboutus-gry"></span>
<span>关于我们</span>
</a>
</li>
<li>
<a href="">
<span class="kefu-gry"></span>
<span>服务建设</span>
</a>
</li>
<li><a href="">
<span class="chanpin-gry"></span>
<span>产品中心</span>
</a>
</li>
<li><a href="">
<span class="fuwu-gry"></span>
<span>服务大厅</span>
</a>
</li>
</ul>
</nav>
</section>
</body>
</html>
相关截图:
1回答
同学你好,代码问题:
1、‘关于我们’中类名写错了,多了一个u,导致图标不显示,修改如下
2、移入的时候改变背景色用的是background,这是总属性,这样就把设置的背景图覆盖了。建议只设置背景色
祝学习愉快!
相似问题
回答 2
回答 2