Div side by side display perfect solution

Source: Internet
Author: User

Div side-by-side display perfect solution ~
It's really easy to use.
CSS:
# Mainbg {
Float: left;
Width: 750px;
Margin: 0;
Padding: 0;
Background: URL ("mainbg.gif") Repeat-y top left;
}
# Left {
Float: left;
Width: 150px;
Margin: 0;
Padding: 0;
Background: #333;
}
# Right {
Float: left;
Width: 600px;
Margin: 0;
Padding: 0;
Background: #666;
}

HTML section:
<Div id = "mainbg">
<Div id = "Left"> content on the left </div>
<Div id = "right"> content on the right </div>
</Div>

This leftt and rightare nested in a divblock named mainbg. mainbg.gif is a horizontal straight line with a length of 150 PX. The first 600 pixels are the same color as the left background, and the last pixels are the same color as the right side.

In this way, the blank space under the two short blocks will be added by the same background color. Creates an illusion of the same height. Hey. .

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.