CSS div水平垂直居中和div置于底部

一、水平居中

.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;  
}  

来自:http://blog.csdn.net/sykent/article/details/7791284

posted @ 2016-06-23 10:21  微软小菜鸟  阅读(4535)  评论(0编辑  收藏  举报