Flex Layout Self-made demo

Source: Internet
Author: User

. row {/* Cross */
Display:-webkit-box;//
Display:-webkit-flex; /* Safari */
Display:-moz-box;
Display:-moz-flex;
Display:-ms-flexbox;
Display:flex;
width:100%;
}
. row-wrap {/* No line break * *
-webkit-flex-wrap:wrap;
-moz-flex-wrap:wrap;
-ms-flex-wrap:wrap;
Flex-wrap:wrap;
}
. Col {/* column */
-webkit-box-flex:1;
-webkit-flex:1;
-moz-box-flex:1;
-moz-flex:1;
-ms-flex:1;
Flex:1;
Display:block;
width:100%;
}
. col-10 {
-webkit-box-flex:0;
-webkit-flex:0 0 10%;
-moz-box-flex:0;
-moz-flex:0 0 10%;
-ms-flex:0 0 10%;
flex:0 0 10%;
max-width:10%;
}

. col-20 {
-webkit-box-flex:0;
-webkit-flex:0 0 20%;
-moz-box-flex:0;
-moz-flex:0 0 20%;
-ms-flex:0 0 20%;
flex:0 0 20%;
max-width:20%;
}

. col-25 {
-webkit-box-flex:0;
-webkit-flex:0 0 25%;
-moz-box-flex:0;
-moz-flex:0 0 25%;
-ms-flex:0 0 25%;
flex:0 0 25%;
max-width:25%;
}

. col-33,. col-34 {
-webkit-box-flex:0;
-webkit-flex:0 0 33.3333%;
-moz-box-flex:0;
-moz-flex:0 0 33.3333%;
-ms-flex:0 0 33.3333%;
flex:0 0 33.3333%;
max-width:33.3333%;
}

. col-50 {
-webkit-box-flex:0;
-webkit-flex:0 0 50%;
-moz-box-flex:0;
-moz-flex:0 0 50%;
-ms-flex:0 0 50%;
flex:0 0 50%;
max-width:50%;
}

. col-66,. col-67 {
-webkit-box-flex:0;
-webkit-flex:0 0 66.6666%;
-moz-box-flex:0;
-moz-flex:0 0 66.6666%;
-ms-flex:0 0 66.6666%;
flex:0 0 66.6666%;
max-width:66.6666%;
}

. col-75 {
-webkit-box-flex:0;
-webkit-flex:0 0 75%;
-moz-box-flex:0;
-moz-flex:0 0 75%;
-ms-flex:0 0 75%;
flex:0 0 75%;
max-width:75%;
}

. col-80 {
-webkit-box-flex:0;
-webkit-flex:0 0 80%;
-moz-box-flex:0;
-moz-flex:0 0 80%;
-ms-flex:0 0 80%;
flex:0 0 80%;
max-width:80%;
}

. col-90 {
-webkit-box-flex:0;
-webkit-flex:0 0 90%;
-moz-box-flex:0;
-moz-flex:0 0 90%;
-ms-flex:0 0 90%;
flex:0 0 90%;
max-width:90%;
}
div {
margin-bottom:20px;
height:100px!important;
Width:auto;
Color: #fff;
font-size:18px;
Font-weight:bold;
}

. bg-r {
background:red;
}
. bg-b {
Background:black;
}
. bg-y {
Background:yellow;
}
. bg-g {
Background:green;
}
. bg-w {
Background:white;
}
. bg-p {
Background:pink;
}
. POSITIVE-BG {
Background-color: #387ef5; }

. positive-border {
Border-color: #0c63ee; }

. Calm, A.calm {
Color: #11c1f3; }

. CALM-BG {
Background-color: #11c1f3; }

. calm-border {
Border-color: #0a9ec7; }

. Assertive, A.assertive {
Color: #ef473a; }

. ASSERTIVE-BG {
Background-color: #ef473a; }

. assertive-border {
Border-color: #e42012; }

. Balanced, a.balanced {
Color: #33cd5f; }

. BALANCED-BG {
Background-color: #33cd5f; }

<! DOCTYPE html>
<meta charset= "UTF-8" >
<title> Mobile Flex Ultimate Perverted Layout </title>
<meta charset= "Utf-8" >
<meta http-equiv= "Content-type" content= "text/html; Charset=utf-8 "/>
<meta name= "format-detection" content= "Telephone=no"/>
<meta name= "viewport" content= "Width=device-width, initial-scale=1.0, maximum-scale=1.0, User-scalable=no" >
<link type= "Text/css" rel= "stylesheet" href= "Xiaoye.css" ></link>
<body>
<div class= "Row" >
<div class= "Col bg-r" ></div>
<div class= "Col bg-y" >2</div>
<div class= "Col bg-b" >3</div>
</div>
<div class= "Row" >
<div class= "Col col-20 bg-r" >20%</div>
<div class= "Col col-30 bg-y" >30%</div>
<div class= "Col col-50 bg-b" >50%</div>
</div>
<div class= "Row" >
<div class= "Col col-10 bg-w" >10%</div>
<div class= "Col col-20 bg-p" >20%</div>
<div class= "Col col-70 bg-g" >70%</div>
</div>
<div class= "Row" >
<div class= "Col col-33 bg-r" >33%</div>
<div class= "Col col-33 bg-y" >33%</div>
<div class= "Col col-33 bg-b" >33%</div>
</div>
<div class= "Row" >
<div class= "Col col-25 bg-w" >25%</div>
<div class= "Col col-25 bg-p" >25%</div>
<div class= "Col col-50 bg-g" >50%</div>
</div>
<!--REMEMBER!!!!! You must have col before adding col-xxx, otherwise the low-end Android has a problem--
</body>

Flex Layout Self-made demo

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.