Realization of nine Gongge layout with CSS3 elastic box model

Source: Internet
Author: User

HTML structure:

<div class= "box" ><div class= "top" ><div class= "left" > </div><div class= "Center" > On </div><div class= "Right" > Upper </div></div><div class= "Middle" ><div class= "left" > Left </div><div class= "center" > </div><div class= "right" > R </div></div><div class= "Bottom" ><div class= "left" > Down </div><div class= "center" > Under </div><div class= " Right > Down </div></div></div>

CSS style:

. box {display:-webkit-box;/* old version, declare flexible box */-webkit-box-orient:vertical;/* old version, spindle direction */-webkit-box-direction:normal; * old version, reverse, positive sequence for normal */-webkit-box-pack:justify; /* old version, spindle on its way, both ends of the alignment */-webkit-box-align:center; /* old version, cross-axis on its way, shrink center */Display:flex; /* New, DECLARE elastic box */flex-direction:column; /* New, vertical reverse, combined with the old version of-webkit-box-orient and-webkit-box-direction */flex-wrap:nowrap; /* New, the parent element spindle size is not enough when the child element wrapping, the old version did not find the corresponding properties */Justify-content:space-between; /* New version, the main axis of its way, at both ends, and the old version of-webkit-box-pack corresponds to */align-items:center;  /* New, cross-axis of its way, contraction center, and the old version of-webkit-box-align corresponding */}.top,.middle,.bottom {width:100%; Display:-webkit-box;/* old version, declare flexible box */-webkit-box-orient:horizontal;/* old version, spindle direction */-webkit-box-direction:normal; /* old version, reverse, positive sequence for normal */-webkit-box-pack:justify; /* old version, spindle on its way, both ends of the alignment */-webkit-box-align:center; /* old version, cross-axis on its way, shrink center */Display:flex; /* New, DECLARE elastic box */flex-direction:row; /* New, vertical reverse, combined with the old version of-webkit-box-orient and-webkit-box-direction */flex-wrap:nowrap; /* New, child element wrapping when parent element spindle size is not enough, the previous version did not find the corresponding attribute */Justify-content:space-between; /* New version, the main axis of its way, at both ends, and the old version of-webkit-box-pack corresponds to */align-items:center;  /* New, cross-axis of its way, contraction center, and the old version of-webkit-box-align corresponding */}.top,.middle,.bottom,.left,.center,.right {-webkit-box-flex:0;  Flex-basis:auto;  flex-grow:0;  flex-shrink:0; flex:0 0 Auto;}.  top,.left {-webkit-box-ordinal-group:1; Order:1;}.  middle,.center {-webkit-box-ordinal-group:2; Order:2;}.  bottom,.right {-webkit-box-ordinal-group:3; Order:3;}

Briefly:

Realization of nine Gongge layout with CSS3 elastic box model

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.