Home > Web Front-end > CSS Tutorial > Share examples of using Flexbox to achieve centering effects in CSS

Share examples of using Flexbox to achieve centering effects in CSS

高洛峰
Release: 2017-03-10 11:13:00
Original
1439 people have browsed it

This article shares examples of using Flexbox to achieve centering effects in CSS. Pay attention to the compatibility issues in IE browsers. Friends in need can refer to it

The future development direction of CSS is to use Flexbox. Designed to solve common problems like vertical centering. Please note that Flexbox has more than one way to center. It can also be used to divide columns and solve weird layout problems.
Share examples of using Flexbox to achieve centering effects in CSS

.Center-Container.is-Flexbox {   
  display: -webkit-box;   
  display: -moz-box;   
  display: -ms-flexbox;   
  display: -webkit-flex;   
  display: flex;   
  -webkit-box-align: center;   
     -moz-box-align: center;   
     -ms-flex-align: center;   
  -webkit-align-items: center;   
          align-items: center;   
  -webkit-box-pack: center;   
     -moz-box-pack: center;   
     -ms-flex-pack: center;   
  -webkit-justify-content: center;   
          justify-content: center;   
}
Copy after login

Benefits:

The content can be any height and width, and it will perform well overflow
Can be used for various advanced layout techniques

Also note: IE8-9 is not supported

Need to write styles on the body, or require additional containers
Need various manufacturer prefixes to be compatible with modern browsers
There may be potential Performance issues


The above is the detailed content of Share examples of using Flexbox to achieve centering effects in CSS. For more information, please follow other related articles on the PHP Chinese website!

Related labels:
source:php.cn
Statement of this Website
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
Popular Tutorials
More>
Latest Downloads
More>
Web Effects
Website Source Code
Website Materials
Front End Template