Workaround for a blank bug on the right side of the CSS background when the window is zoomed out

Source: Internet
Author: User

The page container (#wrap) is 100% width from the page header (#header). The contents of the container (#page) are fixed width 960px. The difference in width understanding occurs when the Browse window shrinks and is smaller than the content layer width. The window width is greater than the width of the content layer as shown:

Change the size of the browser window, less than the content layer width, as shown in.

Drag the horizontal scroll bar and the bug appears. The background on the right doesn't exist. As shown in.

The root of the problem is that when the window shrinks, the browser default width of 100% is the width of the browser window. While ignoring the lower content layer fixed width (960px). The result is a fixed width greater than 100% width. Browsing with this understanding to parse the page, there is a difference in the container width understanding, there is a very strange bug.

We analyze, the solution of the problem: since it is the difference in width understanding, only need to tell the browser page container width, the width of the head element can not be less than the width of the content layer. When the browser window shrinks, the minimum width of the page container and the head element remains the width of the content layer. This solves the problem on the width.

The CSS code is:

min-width:960px;}    #header {width:100%;    height:78px;    border-bottom:1px solid #f60; Background: #f0f0f0 URL (head_tbg.jpg) repeat-x;}    #page {width:960px;    height:100px;    MARGIN:5PX Auto;    Background: #fff; border:1px solid #00CCCC;}

The HTML code is:

<div id= "wrap" > <div id= "header" ></div> <div id= "page" ></div></div>

Workaround for a blank bug on the right side of the CSS background when the window is zoomed out

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.