Mobile Page Production 3
Using the box-sizing mentioned in the previous section to solve a problem of flow pattern layout
A streaming layout of code around the width+border>100% so the box will fall down
<!DOCTYPE HTML><HTMLLang= "en"><Head> <MetaCharSet= "UTF-8"> <title>Document</title> <style>#box{width:100%;Height:300px;background:#fec; }#left{width:50%;Height:200px;float: Left;Border:1px solid #f00;background:Orange; }#right{width:50%;Height:200px;float: Left;Border:1px solid #f00;background:Blue; } </style></Head><Body> <DivID= "box"> <DivID= "Left"></Div> <DivID= "Right"></Div> </Div></Body></HTML>
After using box-sizing
1 <!DOCTYPE HTML>2 <HTMLLang= "en">3 <Head>4 <MetaCharSet= "UTF-8">5 <title>Document</title>6 <style>7 #box{8 width:100%;9 Height:300px;Ten background:#fec; One } A #left{ - width:50%; - Height:200px; the float: Left; - Border:1px solid #f00; - background:Orange; - -webkit-box-sizing:Border-box; + -moz-box-sizing:Border-box; - box-sizing:Border-box; + } A #right{ at width:50%; - Height:200px; - float: Left; - Border:1px solid #f00; - background:Blue; - -webkit-box-sizing:Border-box; in -moz-box-sizing:Border-box; - box-sizing:Border-box; to + } - </style> the </Head> * <Body> $ <DivID= "box">Panax Notoginseng <DivID= "Left"></Div> - <DivID= "Right"></Div> the </Div> + </Body> A </HTML>
The display was found aligned.
Learn Mobile page making 3