码迷,mamicode.com
首页 > Web开发 > 详细

css 垂直居中

时间:2018-03-05 11:18:19      阅读:151      评论:0      收藏:0      [点我收藏+]

标签:fat   class   osi   tran   log   垂直居中   情况下   nsf   orm   

1.在不知道 父元素和自身元素宽高的情况下,实现垂直居中的代码如下:

 

.father{         position:relative;    
.child{         position: absolute;         top: 50%;         transform: translateY(-50%);  }
 

 

css 垂直居中

标签:fat   class   osi   tran   log   垂直居中   情况下   nsf   orm   

原文地址:https://www.cnblogs.com/Li-Sun-Moon/p/8507349.html

(0)
(0)
   
举报
评论 一句话评论(0
登录后才能评论!
© 2014 mamicode.com 版权所有  联系我们:gaon5@hotmail.com
迷上了代码!