为什么一开始全局设置内边距外边距0,ul还是下移?ul写了padding0 20px,为什么没有上移
<!DOCTYPE html>
<html>
<head>
<title>heikuang</title>
<style type="text/css">
.*{
padding: 0;
margin: 0;
}
.out{
width: 800px;
height: 100px;
background-color: black;
border: 2px dashed red;
position: absolute;
top: 0;
left: 0;
right: 0;
bottom: 0;
margin: auto auto;
}
.logo{
float: left;
}
ul{
float: right;
list-style: none;
font-family: "微软雅黑";
font-size: 20px;
/*color: white;*/
padding: 0 20px;
}
li{
float: left;
margin-right: 20px;
line-height: 100px;
}
a{
color: white;
text-decoration: none;
}
a:hover li{
color: yellow;
}
</style>
</head>
<body>
<div class="out">
<div class="logo"><a href=""><img src="http://img1.sycdn.imooc.com/climg//58c0d2d900016ce303000100.png"></a></div>
<div>
<ul>
<li><a href="">帮助</a></li>
<li><a href="">联系我们</a></li>
<li><a href="">资料</a></li>
<li><a href="">客服电话</a></li>
</ul>
</div>
</div>
</body>
</html>
正在回答 回答被采纳积分+1
- 参与学习 人
- 提交作业 11218 份
- 解答问题 36712 个
从一个不会编程的小白到一个老司机是需要过程的,首先得入门,学习基础知识,然后才能进阶,最后再到精通,本专题是你走进前端世界的不二选择!
了解课程



恭喜解决一个难题,获得1积分~
来为老师/同学的回答评分吧
0 星