transform translateY(-50%) 实现元素垂直居中效果

在相对的空间内,垂直居中。position: relative;top: 50%;transform: translateY(-50%);

 

无论内容怎么增加,全文都是垂直居中的。

posted @ 2017-09-04 13:35  peko  阅读(621)  评论(0编辑  收藏  举报