Let's talk about a question I started working on.
I remember in the Pacific Network interview, the interviewer gave me such a problem: there is an outer div in the middle of the left and right two Div requires Div
1. Only tell you the width; 2. Only tell you the height; 3. Width and height tell you; (I summed up the possible 3 ways)
<Divclass= "Container"><Divclass= "Left">Left Fixed width 200px</Div><Divclass= "Right">Right adaptive</Div></Div>
.container {width : 100% ; }.left {color : red ; background : Gray ; float : left ; : 100px } on the left side of >// {color : red ; background : blue ; Margin-left : -200px ;} //right-hand div
No2: Method Two
. Container{width:100%;}. Left{width:200px;background:#fcc;position:Absolute; Left:0;Z-index:1}. Right{width:100%;background:#ccc;position:Absolute; Left:0}
No3: Method Three
.container {width : 100% }.left { Background-color : green ; float : left ; : 200px ; Margin-right : -100% ; }.right { float : left ; : 100% ; margin-left : 200px ; Background-color : blue ; }
No4: Method Four
. Container {width:100%} . Left {position: absolute; top:0; Left:0; width:200px; background: #ff0;} . Right { margin-left: 200px; background: #f0f;}
No5: Method 5
. Container{width:100%}. Left{position:Absolute;Top:0; Left:0;width:200px;background:Blue;}. Right{position:Absolute;Top:0; Left:200px;width:100%;rigth:0;background:Red;}
In fact there are many ways to achieve (other I do not bother to write), so-called all roads to Rome, cough, do not like to spray
Left fixed in CSS, right adaptive