麻烦老师检查优化一下代码
来源:4-4 自由编程
			扶耳摩兔
2021-01-09 13:00:31
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<title>Document</title>
<link rel="stylesheet" href="../css/css.css">
</head>
<body>
<header>
<div class="head">
<h1 class="logo">Career Builder</h1>
<nav class="main_nav">
<ul>
<li><a href="">HOME</a></li>
<li><a href="">ABOUT</a></li>
<li><a href="">GALLERY</a></li>
<li><a href="">FACULTY</a></li>
<li><a href="">EVENTS</a></li>
<li><a href="">CONTACT</a></li>
</ul>
</nav>
</div>
</div>
</header>
</body>
</html>
*{
    padding: 0;
    margin: 0;
}
header{
    height: 80px;
    background-color: #07cbc9;
}
header .head{
    width: 1200px;
    height: 80px;
    margin: 0 auto;
    position: relative;
}
header .head h1{
    display: inline-block;
    height: 48px;
    width: 300px;
    float: left;
    /* margin-right: 480px; */
    /* position: absolute;
    top: 50%;
    margin-top: -; */
    line-height: 80px;
    color: white;
    font-family: Times New Roman;
}
header .head h1.logo{
    text-align: center;
}
header .head ul{
    float: right;
    width: 580px;
    height: 80px;
    list-style: none;
}
header .head ul li{
    display: inline-block;
    float: left;
    width: 80px;
    height: 80px;
    margin-right: 20px;
}
header .head ul li:last-child{
    margin-right: 0;
}
header .head ul li a{
    display: block;
    width: 80px;
    height: 80px;
    font-size: 16px;
    color: white;
    text-decoration: none;
    text-align: center;
    line-height: 80px;
}
header .head ul li a:hover{
    background-color: #00978E;
}
1回答
同学你好,老师测试代码时候发现全局这个*的前面有个小点,导致了没有生效,去掉后代码就没有问题了,同学本地测试没有这个问题可以忽略。

祝学习愉快!
相似问题