One side is fixed wide, the side of the Adaptive page layout in the current use of a lot, what are the implementation methods?
1, by floating and margin take positive values to achieve:
The fixed width element is #sidebar
The adaptive element is #content
The CSS code is as follows:
Set float for a given wide element
#sidebar {
Float:left;
width:200px; height:600px;
background-color:red;
}
What about the adaptive elements? Let's set the margin-left for him, which is better than the width of the above element.
#content {
width:100%; If it is a div block-level element, width is not set or can be
height:600px;
margin-left:210px;
Background-color:black;
}
2, by floating and margin to take negative values to achieve:
The fixed width element is #sidebar
The adaptive element is #content
The CSS code is as follows:
#content {
Float:left;
width:100%;
height:600px;
margin-right:-200px;
Background-color:black;
}
#sidebar {
Float:left;
width:200px;
height:600px;
background-color:red;
}
The "CSS" side is fixed wide, the other side of the adaptive layout how to do