Achieve two columns of equal height

Source: Internet
Author: User

First HTML is as follows:

<!DOCTYPE HTML><HTML>    <Head>        <MetaCharSet= "Utf-8"/>        <styletype= "Text/css">
body{
Background-color: #eee;
}
#wrap{width:600px;margin:50px Auto;Background-color:#eee;Overflow:Hidden; /*in order to produce BFC*/ }#left{width:273px;float: Left;padding:10px;Background-color: White; }#right{width:273px;float: Right;padding:10px;Background-color:#ccc; } </style> </Head> <Body> <DivID= "Wrap"> <DivID= "Left">I'm on the left, I'm a little shorter than the right. I'm on the left, I'm a little shorter than the right. I'm on the left, I'm a little shorter than the right.</Div> <DivID= "Right">I'm on the right, I'm a bit longer than the left. I'm on the right, I'm a bit longer than the left. I'm on the right, I'm a bit longer than the left. I'm on the right, I'm a bit longer than the left. I'm on the right, I'm a bit longer than the left. I'm on the right, I'm a bit longer than the left.</Div> </Div> </Body></HTML>

The effect is as follows:

So, how do you make these two columns as high?

1. Negative margins
<styletype= "Text/css">Body{Background-color:#eee;            }#wrap{width:600px;margin:50px Auto;Background-color:#eee;Overflow:Hidden;      /*in order to produce BFC*/            }#left{width:273px;float: Left;padding:10px;Background-color: White;Padding-bottom:9999px;  /* Overflow:hiddenwith Div, achieve equal height*/Margin-bottom:-9999px;            }#right{width:273px;float: Right;padding:10px;Background-color:#ccc;            }        </style>

The effect is as follows:

Achieve two columns of equal height

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.