怎么让一个不定宽高的DIV,垂直水平居中?
使用CSS方法:
父盒子设置:display: table-cell; text-align: center; vertical-align: middle;
Div 设置: display: inline-block; vertical-align: middl;
便用 CSS3transform:
父盒子设置:display: relative
Div 设置:transform: translate(-50%, -50%) ; position: absolute; top: 50%; left: 50%;

Was this helpful?

0 / 0

发表回复 0

Your email address will not be published.