开发者

Can't get 960.gs grid container to span full browser height

开发者 https://www.devze.com 2023-04-05 12:28 出处:网络
I have been working on a project using Compass with the 960.gs plugin. It\'s worked quite well so far, giving results that look nearly identical across browsers with little effort. I\'ve run into a sm

I have been working on a project using Compass with the 960.gs plugin. It's worked quite well so far, giving results that look nearly identical across browsers with little effort. I've run into a small problem, however.

The div I am using as 960's main grid container has a vertically tiled background in CSS. I need this background to extend all the way to the bottom of the browser's viewport, but it would seem that 960's use of floats is somehow conflicting with this.

Despite the container's height being set to 100%, the background only extends part of the way down the screen when overflow is unspecified. Setting overflow to hidden fixes it, but hides the scrollbars!

How can this be dealt with? I've used Webkit's inspector look through the code and DOM for problems and as far as I can see there's nothing that should cause this behavior.

It's not online and the code is too large to copy and paste here, but I will recreate the structure in abbreviated psuedocode:

<html>
<head></head>
<body>
   <primary background div>
       <960 container div>
           <header div>Stuff</div>
           <main content div>More Stuff</div>
           <footer div></div>
       </div>
   </div>
</body>
</html>

I've scanned the CSS is there is nothing problematic开发者_高级运维. I'm not floating anything and the most I'm doing is small padding and margins...


It's hard to tell without the actual code, but the prerequisite for block to stretch at 100% is one of these:

  • It's parent have an absolute set height (like 100px etc.).
  • Or all parent of this block till HTML tag must have height: 100%.

So, look at this example: http://jsfiddle.net/kizu/UvAxV/ — there on frame hover HTML and BODY get height: 100% and the wrapper stretches to 100% too.

So, in your case, you must to make sure that HTML, BODY and “primary background div” all have height: 100%

0

精彩评论

暂无评论...
验证码 换一张
取 消