Flexbox scaling layout box and flexbox scaling Layout
Flexbox)It is a new layout mode in CSS3, designed for more complex web page requirements in modern networks.
FlexboxScaling containerAndScaling Project. You can set the display attribute of an element to flex or inline-flex to obtain a scaling container.
Setflex
The container is rendered as a block-level element and setinline-flex
Is rendered as a line element.
For example, set the element named flex-container to a scaling container.
. Flex-container {display:-webkit-flex; display: flex ;}
Each sub-element in the scaling container is a scaling project. Scaling projects can be any number. All elements outside the scaling container and within the scaling project are not affected.
To put it simply, Flexbox defines how scaling projects in a scaling container are laid out.
Flex Lines
The scaling project followsScaling rowLocate. Generally, each scaling container has only one scaling row. Default scaling row from left to right
Example:
1 <div class = "flex-container"> 2 <div class = "flex-item"> flex item 1 </div> 3 <div class = "flex-item"> flex item 2 </div> 4 </div> 5 6 style: 7 8. flex-container {9 display:-webkit-flex; 10 display: flex; 11 width: 300px; 12 height: 240px; 13 background-color: Silver; 14} 15 16. flex-item {17 background-color: DeepSkyBlue; 18 width: 100px; 19 height: 100px; 20 margin: 5px; 21}View Code
:
Add
<div class="flex-item">flex item 3</div>
<Div class = "flex-item"> flex item 4 </div>
The width of a scaling project exceeds the width of the scaling container. The width of the scaling container does not change, and the width of the scaling project is reduced.