DIV+CSS layout cannot display background color What's going on?

Source: Internet
Author: User

Div CSS Novice Layout will encounter the layout of the background color can not be displayed, general layout background can not be displayed usually the following reasons:

1, by the use of float float caused by the float can not display the CSS background color
2, the height is not enough to produce background can not be displayed

Next, we'll explain why and how we can't display the background color or picture separately.

one, the CSS float float to produce the float cannot display the background style color

If you set an object background background color style, the object inside the box has a float floating property style, this time the object floated, causing the object can not be stretched, so the CSS background color can not be displayed, there are three solutions, one is to set clear clean floating , set the CSS height, and set the CSS overflow style.

Detailed tutorial accessible: CSS Clear floating

second, the height limit caused the background color can not be displayed intact

Reason Analysis:
If you have an object that does not compute the height (or accidentally set a very small height attribute style), because the content is not sure how much, when the content than you set the height limit, this time out of a part of the background may not be displayed.

Workaround:
Set the height high enough, or remove the height style.

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.