The previous layout "Middle self-adaptive two sides fixed" with three methods to solve, this is not a common layout format, look at the solution, first look at the simple solution
The first type: absolute positioning
<!DOCTYPE HTML><HTMLLang= "en"><Head> <MetaCharSet= "UTF-8"> <title>Document</title> <style>Html,body{Height:100%;padding:0;margin:0;}Div{Height:100%;}. Main{width:500px;background:Yellow;position:Absolute;Top:0; Left:50%;Margin-left:-250px;Z-index:5;}. Left,.right{position:Absolute;width:50%; Left:0;Z-index:2;background:Black;}. Right{position:Absolute;width:50%; Right:0;Z-index:2;background:Black;} </style></Head><Body> <Divclass= "Left"></Div> <Divclass= "Main"></Div> <Divclass= "Right"></Div></Body></HTML>
Very easy to solve
The second type: floating
<!DOCTYPE HTML><HTMLLang= "en"><Head> <MetaCharSet= "UTF-8"> <title>Document</title> <style>Html,body{Height:100%;padding:0;margin:0;}Div{Height:100%;}. Left,.right{width:50%;float: Left;Margin-left:-250px;background:Blue;}. Main{width:500px;float: Left;background:Yellow;}. Right. Inner,.left. Inner{Margin-left:250px;background:#000; } </style></Head><Body> <Divclass= "Left"> <Divclass= "inner">This is the left sidebar content</Div> </Div> <Divclass= "Main"> </Div> <Divclass= "Right"> "" <Divclass= "inner">This is right Siderbar content</Div> </Div></Body></HTML>
The width of the middle main is fixed, and then let it do the floating, the key is set in the left and right sidebar, this method is to make it all 50% width setting, and add the negative left margin, and then in the left and right sidebar of the inner layer Div.inner it to display the place to pull back, OK
The third type: CSS3 Flex
Middle fixed two-sided adaptive three-column layout