为什么我的top那一块不能居中显示
<!DOCTYPE html> <html> <head> <title>网页开发</title> <link rel="stylesheet" type="text/css" href="css/project.css"> </head> <body> <div class="top"> <div class="top1"> <div class="top-img"><img src="images/logo.png"></div> </div> </div> <div class="banner"></div> <div class="about"></div> <div class="gallery"></div> <div class="footer"></div> </body> </html>
*{
margin: 0px;
padding: 0px;
}
.top{
height: 80px;
width: 100%;
background-color: #07cbc9;
}
.top .top1 .top-img{
margin: 25px auto;
line-height: 40px;
height: 40px;
float: left;
}
0
收起
正在回答
2回答
您好,参考如下:
*{
margin: 0px;
padding: 0px;
}
.top{
height: 80px;
width: 100%;
background-color: #07cbc9;
}
.top .top1 .top-img{
/*margin: 25px auto;*/
line-height: 80px;
height: 80px;
float: left;
}
.top .top1 .top-img img{
vertical-align:middle;
}祝学习愉快!
PHP小白零基础入门
- 参与学习 人
- 提交作业 626 份
- 解答问题 4928 个
想要学好Web后端开发的中流砥柱语言,本阶段为你轻松铺就扎实的基础,从前端网页布局的搭建到后台PHP开发,助你从零基础到掌握主流开发语言。
了解课程

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