yanhaijing/vertical-center

垂直水平居中:display: -webkit-box

Open

#6 opened on Jun 5, 2020

View on GitHub
 (4 comments) (0 reactions) (1 assignee)HTML (444 stars) (60 forks)batch import
help wanted

Description

拜读大佬文章,受益颇多。

这里补充一种实现垂直水平的方法:display: -webkit-box

父元素设置:

display: -webkit-box;
/** 水平居中**/
-webkit-box-pack: center;
/** 垂直居中**/
-webkit-box-align: center;

缺点也很明显,兼容性不太好。

参见:https://ataola.github.io/show/zj/center-middle.html

Contributor guide