请老师检查,谢谢
来源:2-2 编程练习
weixin_慕仔2495609
2019-05-21 11:43:04
<!DOCTYPE html>
<html>
<head>
<meta charset="UTF-8">
<title>IMOOC</title>
<style type="text/css">
*{
padding: 0;
margin: 0;
}
a{
text-decoration: none;
color:#fff;
}
header{
width:100%;
height:80px;
background-color: black;
}
header .container{
width:1200px;
height:80px;
margin: 0 auto;
}
header .container .logo{
float:left;
text-align:center;
height:80px;
line-height:80px;
font-size:24px;
margin-top:10px;
}
header .container nav{
float:right;
height:73px;
line-height:73px;
font-size:24px;
color:#fff;
margin-right:10px;
}
header .container nav a{
display:block;
float:left;
width:100px;
text-align:center;
}
header .container nav a.one{background-color: #d40112;}
header .container nav a.two{background-color: #feb800;}
header .container nav a.there{background-color: #78b917;}
header .container nav a.four{background-color: #433b90;}
header .container nav a.five{background-color: #f27c01; }
header .container nav a.six{ background-color: #017fcb;}
header .container nav a:hover{
padding-bottom:7px;
}
</style>
</head>
<body>
<header>
<div class="container">
<div class="logo">
<a href="#"><img src="http://climg.mukewang.com/582e5f160001b17100400040.png"></a>
<a href="#"><span>MYMOOC</span></a>
</div>
<nav>
<a href="#" class="one">Home</a>
<a href="#" class="two">Course</a>
<a href="#" class="there">Actual</a>
<a href="#" class="four">Plan</a>
<a href="#" class="five">FAQ</a>
<a href="#" class="six">Notes</a>
</nav>
</div>
</header>
</body>
</html>
1回答
你好,logo整体超出了父容器:

是因为设置行高还设置了外边距的原因,可以直接给img图片设置上边距,参考:

祝学习愉快!
相似问题