CSS3 Flexbox Layout----Flex Project Properties Introduction

Source: Internet
Author: User

Tag: Indicates ISP content text IDT meaning sort style display

Now introduce the CSS properties used in the Flex project, HTML structure or with UL, Li structure, but the content changed to a display:flex, style, directly to the UL set to the Flex container, the default spindle direction for the horizontal direction. Index.html

 <  ul         >  <  li  >  1</ li         >  <  li  >  2</ li         >  <  li  >  3</ li  >  </ ul  >  

Index.css

ul{Display:Flex;width:600px;Border:1px solid Red;}Li{width:100px;Height:100px;margin:8px;padding:4px;text-align:Center;Line-height:100px;Background-color:#8cacea;}

This page shows the following:

There are a total of 5 properties used on Flex projects, order | | flex-basis | | Flex-grow | | Flex-shrink | | Flex

Order, as implies, sequential meaning, is to re-order each flex project without changing the HTML structure, such as getting the first item on the last side, its value is a number, positive, negative, 0 can be, such as 8. When the browser is redrawn, the Flex project is rearranged according to this number, with the rules being small to large, which item has a large order property, which item is in the back, and vice versa, and if two flex projects have equal order values, they are arranged in the structure defined in the HTML.   Of course, the order default value for each flex project is 0, indicating that the flex project is arranged according to the structure defined in the HTML. We add an order attribute to each Li, according to the rule, the third item is ranked first, the second item is the same, the first item is the last one.
{    order: 3;}  {    order: 2;}  {    order: 1;}

The page looks the same as we expected

Flex-basis, before the FLEX-SHINRK and Flex-grow properties work, it controls the default size of each flex project, Flex-shrink and Flex-grow we'll talk about next. Value of flex-basis: Auto | | <length> length is the value of some of our usual properties, such as PX, REM.

The default value of Flex-basic is auto, what does auto mean?

CSS3 Flexbox Layout----Flex Project Properties Introduction

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.