老师请检查一下, 代码是否需要改善
来源:2-4 编程练习
等吃糖葫芦的阿狸
2019-08-28 23:07:09
<!DOCTYPE html>
<html>
<head>
<title>布局编程练习2-4</title>
<style type="text/css">
*{
margin:0; padding: 0;
}
.nav{
width: 1100px;
height: 100px;
background-color: black;
font-family: "微软雅黑";
text-align: center;
line-height: 100px;
margin: 0 auto;
position: fixed;
top: 0;
left: 50%;
margin-left: -550px;
}
.logo{
float: left;
cursor: pointer;
}
.nav-ul{
float: right;
margin-right: 20px;
color: white;
}
.li1,.li2,.li3,.li4,.li5{
float: left;
margin-left: 30px;
cursor: pointer;
}
.nav-ul li{
list-style: none;
}
</style>
</head>
<body>
<div class="nav">
<div class="logo">
<img src="http://climg.mukewang.com/58c0d2d900016ce303000100.png">
</div>
<div class="nav-ul">
<ul>
<li class="li1">课程</li>
<li class="li2">职业路径</li>
<li class="li3">实战</li>
<li class="li4">猿问</li>
<li class="li5">手记</li>
</ul>
</div>
</div>
</body>
</html>
1回答
同学你好, 代码效果实现很棒
建议优化: 可以统一给li设置样式, 简化代码的书写哦
如果帮助到了你, 欢迎采纳!
祝学习愉快~~~
相似问题