Home > php教程 > PHP开发 > Comprehensive understanding of the uses of flex

Comprehensive understanding of the uses of flex

高洛峰
Release: 2016-12-27 16:27:10
Original
1152 people have browsed it

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

For example: html code:

<div class="container">
    <div class="box">
 
    </div>
    </div>
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. Flex properties

<div class="items">
    <div class="item">1</div>
    <div class="item">23</div>
    <div class="item">4</div>
    </div>
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 the item:

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

The above is all the content that the editor has brought to you to fully understand the use of flex. I hope you will support the PHP Chinese website~

For more articles related to a comprehensive understanding of the use of flex, please pay attention to 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 Recommendations
Popular Tutorials
More>
Latest Downloads
More>
Web Effects
Website Source Code
Website Materials
Front End Template