For example, adaptive height on the right side
Dom structure:
<Div id = "Main">
<Div id = "Left"> </div>
<Div id = "right"> </div>
</Div>
Set the left and right backgrounds to the maximum:Padding-bottom: 5000px; margin-bottom:-5000px;Set a background to see the effect.
Then, by setting the mainOverflow: hiddenHide unnecessary regions
<! Doctype HTML public "-// W3C // dtd xhtml 1.0 transitional // en" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<HTML xmlns = "http://www.w3.org/1999/xhtml">
<Head>
<Meta http-equiv = "Content-Type" content = "text/html; charset = GBK"/>
<Title> high CSS layout </title>
<Style type = "text/CSS">
Body {margin: 0; padding: 0; Font: 14px/1.6em Arial, Helvetica,, sans-serif; text-align: CNTER ;}
. Main {
Width: 800px;
Margin: 0 auto;
Margin-top: 20px;
Color: # FFF;
Background: #333;
Overflow: hidden;
}
. Left {
Float: left;
Width: 550px;
Background: # f00;
Border: 1px solid #666;
Padding-bottom: 5000px;
Margin-bottom:-5000px;
}
. Right {
Float: right;
Width: 240px;
Background: #090;
Border: 1px solid #666;
Padding-bottom: 5000px;
Margin-bottom:-5000px;
}
</Style>
</Head>
<Body>
<Div class = "Main">
<Div class = "Left">
<P> I am very high </P>
<P> I am very tall </P> <p> I am also very tall </P>
<P> I am very high </P>
<P> I am very tall </P> <p> I am also very tall </P>
<P> I am very high </P>
<P> I am very tall </P> <p> I am also very tall </P>
<P> I am very high </P>
</Div>
<Div class = "right">
<P> will I be as tall as the one on the left? </P>
<P> I am as tall as I am on the left! </P>
</Div>
</Div>
</Body>
</Html>