Home  >  Article  >  Web Front-end  >  [CSS] Two ways to vertically center child elements

[CSS] Two ways to vertically center child elements

高洛峰
高洛峰Original
2017-02-21 10:59:032075browse

1. Multiple sub-elements are arranged horizontally, invalid below IE10

display: flex;
align-items: center;
justify-content: center;

[CSS] 子元素垂直居中的两种方式

2. Multiple sub-elements are arranged vertically. This method will cause the margin to be invalid and invalid below IE8

display: table-cell;
vertical-align: middle;

[CSS] 子元素垂直居中的两种方式

 

More [CSS] Two ways to vertically center child elements. For related articles, please pay attention to the PHP Chinese website!

Statement:
The content of this article is voluntarily contributed by netizens, and the copyright belongs to the original author. This site does not assume corresponding legal responsibility. If you find any content suspected of plagiarism or infringement, please contact admin@php.cn