views:

582

answers:

5

When the browser window is small enough to force a horizontal scrollbar and you scroll right the background color of the header ends before the edge of the browser. I am using a css class.

.s_header {
    margin: 0;
    width: 100%;
    display: block;
    border-bottom: 1px solid #000;
    background-color:#b8dbec;
    height:133px;
}

The contents of <div class="s_header"> are not as wide as the 4 column table below it where the content totals abot 840px with image widths+padding and a 140px fixed width column. So when the browser window is less than 840px there is a horizontal scrollbar which is ok except that the background of the header is cut off when you scroll.

The parent elements of <div class="s_header"> are body and html for which 100% width means the window width. I've tried including overflow:visible in .s_header class without success.

The body width is also set to 100% margin 0

Is there a simple way that I can get the background to extend on the right when a scrollbar appears?

The problem page is at here

Any suggestions will be greatly appreciated.

A: 

I wholeheartedly suggest that you use firefox and install firebug: http://getfirebug.com/

It has this cool feature that lets you inspect a dom element, and it will tell you all styles, and what stylesheet they originate from. So if the body is inheriting some errant padding (or something), you will be able to see visually what's going on :-)

Joel Martinez
+3  A: 

set the margins of your body tag

The in-line way

<body style="margin: 0px 0px 0px 0px;">

In your style.css (or whatever)

body {
  margin: 0px 0px 0px 0px;
}
Robert Greiner
+1 short mode and padding:body { margin: 0; padding: 0 }
gmunkhbaatarmn
I have body { margin: 0; padding: 0 } but it didn't help. The header is much smaller than content...
DashaLuna
A: 

What robbotic suggested is called css reset and you can read about it e.g. here: http://perishablepress.com/press/2007/10/23/a-killer-collection-of-global-css-reset-styles/

A: 

easier way is to create an inner div and set it to the same width as the page goes just before the scrollbar appears example

<div class="s_header"> <div class="inner">

</div> </div>

.inner{ width:990px; background:#f00; margin:0 auto; }

A: 

It looks like the issue is down to the three images in the body table. When you reduces the browser width it causes the three image so bunch up, being in individual table cells they can not wrap resulting in a fixed width.

You could try to fudge the solution by using a repeating background image for the header, but I would re-write the table structure with a floating approach.

Andrew Mason