Flexbox scaling layout box and flexbox scaling Layout

Source: Internet
Author: User

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.

SetflexThe container is rendered as a block-level element and setinline-flexIs 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.

 

Related Article

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.