Detailed explanation of the use of CSS Flex

Guanhui
Release: 2020-07-18 17:47:51
forward
2595 people have browsed it

Detailed explanation of the use of CSS Flex

1. You can use flex to lay out a p and center it horizontally and vertically inside another p

For example: html code:

Copy after login

css code:

.container{ width:600px; height:400px; border:1px solid blue; display: flex; justify-content:center; align-items:center; } .box{ width:200px; height:100px; border:1px red solid;
Copy after login

ps: This way you can center it horizontally and vertically

2. Attributes of flex

1

23

4

Copy after login

There are six attributes that can be written on items:

•flex-direction
•flex-wrap
•flex-flow
•justify-content
•align-items
•align-content

There are 6 items that can be written on items:

•order//This is the item given separately. If you want to change the order of that item, give this attribute to that item
•flex-grow
•flex-shrink
•flex-basis
•flex
•align-self

The above is the detailed content of Detailed explanation of the use of CSS Flex. For more information, please follow other related articles on the PHP Chinese website!

Related labels:
source:jb51.net
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
Latest Downloads
More>
Web Effects
Website Source Code
Website Materials
Front End Template
About us Disclaimer Sitemap
php.cn:Public welfare online PHP training,Help PHP learners grow quickly!