一、水平居中
- .hor_center {
- margin: 0 auto;
- }
二、水平垂直居中
<div class="content"></div>
- .content {
- width: 360px;
- height: 240px;
- }
- .ver_hor_center {
- position: absolute;
- top: 50%;
- left: 50%;
- margin-left: -180px; /*要居中的div的宽度的一半*/
- margin-top: -120px; /*要居中的div的高度的一半*/
- }
三、div置于底部(footer)
- .bottom_footer {
- position: fixed; /*or前面的是absolute就可以用*/
- bottom: 0px;
- }
最后
以上就是干净菠萝最近收集整理的关于CSS div水平垂直居中和div置于底部的全部内容,更多相关CSS内容请搜索靠谱客的其他文章。
本图文内容来源于网友提供,作为学习参考使用,或来自网络收集整理,版权属于原作者所有。
发表评论 取消回复