Against the war elastic layout of the series of three classes

Big brother you good night!
Hello nice day from the beginning, and today I bring you little knowledge about the layout of elasticity,
first of all, we should all know the advantages of elastic layout is done unidimensional, as to why, are explained below Oh!
The reason is called elastic elastic layout layout, it is because the sub-container (flex) available space can take full advantage of the parent container. Well, first of all for all of us to bring a spectrum including:
Here Insert Picture Description

Well! Next we talk about a few details we used elastic layout syntax. The first is our original code and showing:

<style>            ul{list-style: none;}            a{text-decoration: none;}            #box{margin: 20px auto; width: 400px;height: 400px;border: 1px solid black;}            #box div{width: 100px;height: 100px;border: 3px solid black;}            #box div:nth-of-type(1){background-color: red;}            #box div:nth-of-type(2){background-color: green;}            #box div:nth-of-type(3){background-color: blue;}        </style>  
<body>
<div id="box">            <div></div>            <div></div>            <div></div>        </div>
</body

Showing that:
Here Insert Picture Description

Role in the parent container above

  1. flex-direction: to change the direction of the spindle

    Here Insert Picture Description

  2. justify-content: attribute determines the alignment direction of the main shaft and a distributed fashion subkey.
    Here Insert Picture Description

  3. align-items; vertical alignment of subelements in each row. Axis is moved in the sub
    Here Insert Picture Description

  4. flex-wrap: whether the line feed process
    Here Insert Picture Description

Written in the above sub-container

  1. align-self; allow a single sub-container to other sub-containers is not the same alignment can align-items covered property. (In this case the second example)
    Here Insert Picture Description
  2. flex-grow: extended;
    Here Insert Picture DescriptionHere Insert Picture Description

Examples

Here Insert Picture Description
Here Insert Picture Description
Here Insert Picture Description

Note: The
level is the main axis of the time: By default, when the width and height do not write, width is determined by the content, determined by the height of the parent container.
Vertical spindle time: By default, when the width and height when not writing, is determined by the width of the parent container, the height determined by the contents.
When the child is greater than the total width of the parent container, automatically shrink (the priority is greater than its own elasticity fixed size)
when the child has reached the contents of the parent container when the minimum width and height, there will be an overflow phenomenon .

White one, welcome you guidance heavyweights.

Published 10 original articles · won praise 11 · views 451

Guess you like

Origin blog.csdn.net/Anber_wang/article/details/104664227