首页 > Web开发 > 详细

css垂直居中技巧总结

时间:2018-08-24 12:18:13      阅读:183      评论:0      收藏:0      [点我收藏+]

1、Line-height + inline-block

<div class="box box2">
 <div class="content">
   立马来看实际完成的
   效果吧!別忘了拖拉一下窗口看看 RWD 效果喔!  </div>
</div>

h2{
 text-align: center;
}
.box{
 width: 500px;
 border: 1px solid #f00;
 margin: auto;
 line-height: 200px;
 text-align: center;
}
.box2 .content{
 display: inline-block;
 height: auto;
 line-height:1;
 width: 400px;
 background: #ccc;
}

css垂直居中技巧总结

原文:https://www.cnblogs.com/zhangshengwang/p/9528824.html

(0)
(0)
   
举报
评论 一句话评论(0
关于我们 - 联系我们 - 留言反馈 - 联系我们:wmxa8@hotmail.com
© 2014 bubuko.com 版权所有
打开技术之扣,分享程序人生!