I have a div tag and I realized that it is not filling 100% of the height as it should.
My code:
#container {
width: 100vw;
height: 100vh;
background: purple;
}
body {
margin: 0px;
}
<div id="container"></div>
<div id="container"></div>
What's happening?
Well, if I only have this code snippet above that I put the div to occupy 100% of the viewport of course! The problem is that I don't only have this code on my page, I have more things and I inserted this code section inside the body tag, a certain" place "inside the body tag, that is, I inserted some elements, and after these elements have this div, but it does not occupy, 100% of the viewport observe how it is
How is the result visually on your page?
I scrolled the page, but my div was still to occupy 100% of the entire viewport. Am I not correct? and if this was supposed to happen why isn't it happening?
Explanation: Guys, I discovered the problem but I don't know how to solve it, well, here's the thing, the div does not occupy 100% of the viewport when it has an element below the container div or above, look at this image and see:
And the code I used that made this happen:
My code HTML:
body {
color: red;
background: green;
margin: 0;
padding: 0;
}
#container {
width: 100vw;
height: 100vh;
z-index: 1;
background: purple;
}
p {
font-size: 20pt;
}
<div id="container"></div>
<p>ksksks</p>
What happens in the image above is the same problem that happens on my page, that is, the div only fills 100% of the viewport's height if it has no elements on the page, and I want to be able to make the height 100% of the viewport even with elements on the page.
Edit:
Well apparently I saw that there are a lot of answers, and most of them don't work or are explaining the error or presenting answers that don't solve the problem, other people suggested using position fixed which in fact solves the problem, but I don't want to have to do it this way , think that you have a chat because you would want it to have a scrolling bullet and it will be the chat that will occupy the entire viewport and not another div understand? This solution actually solves the problem, but I don't like jerry-rig.
I would like to know a more elegant way of doing it, for example my div container occupies 100% of the viewport but I don't want other elements to appear, I want the div container to overlap any element that should appear and I don't want to scroll the page.
Summary:
To summarize everything in a few words, the div should occupy 100% of the viewport and make sure that the body does not have a scroll and the page goes to the top, that is, regardless of which position on the page the user is in, I want the page to go to the top and disable the scroll, and without javascript preferably, I don't want to write too much javascript being possible to write in html and css :) I will take advantage of the reward in this answer to add this and ask for a solution to this problem.
The problem has to do with the fact that the vh and vw units don't take the (added) scrollbar width/height into consideration. As long as the page isn't higher than the viewport, no scrollbar appears and 100vh will be exactly the height of the viewport and everything works as expected.
But as soon as there is more content below or above, a vertical scrollbar appears: Now the width: 100vw is wider than the window width minus the vertical scrollbar, so a horizontal scrollbar appears, and now the height: 100vh is higher than the window height minus the (horizontal) scrollbar.
I consider that a kind of bug, but that's the way it is - in most browsers, it seems. I posted this question a long time ago which basically covers the same issue: Problem using vw units when a vertical scrollbar appears (full-width elements in WordPress)
Addition/edit after comments:
There is no 100% safe solution, I would say. But one thing that helps to some extent is to not use 100vw for the width, but instead 100%, which does consider the (vertical) scrollbar. However, width: 100%; is the default for any block element anyway, so you can simply erase the width setting and only use height: 100vh, which will work (i.e. have the exact viewport height) as long as you don't have any special width requirements.
Please use the following meta tag inside your head tag
<meta name="viewport" content="width=device-width, initial-scale=1">
<html>
<head>
<meta name="viewport" content="width=device-width, initial-scale=1">
<style>
body {
color: red;
background: green;
margin: 0;
padding: 0;
}
#container {
width: 100vw;
height: 100vh;
z-index: 1;
background: purple;
}
p {
font-size: 20pt;
}
</style>
</head>
<body>
<div id="container"></div>
<p>ksksks</p>
</body>
</html>
Based On your question you want the div to take up the space instead of the purple background right?
Css:
#container {
width: 100vw;
height: 100%;
background: purple;
}
body {
margin: 0px;
}
#innerDiv {
height: 100vw;
background-color: red;
width: 100vw;
}
#innerDiv1 {
height: 100%;
background-color: blue;
width: 100vw;
}
Html:
<div id="container">
</div>
<div id="innerDiv">Div #1</div>
<div id="innerDiv1">Div #2</div>
You applied background purple color upto height of 100vh,
if you want see purple fully you just add purple in body tag instead green or otherwise you want place div inside container .here is nothing problem.you just want to adjust your code
body {
color: red;
background: purple;
margin: 0;
padding: 0;
}
#container {
width: 100vw;
height: 100vh;
z-index: 1;
}
p {
font-size: 20pt;
}
<div id="container"></div>
<p>ksksks</p>
It is just a workaround, I usually used it as mobile hamburger menu with full screen. You have to be careful because it force to cover bfull page, it will hide all element if there is any other element already exists on the page.
.container {
# it make the container always on the page regardless any element or window margin
position: fixed;
top: 0;
left: 0;
z-index: 999;
height: 100vh;
width: 100vw;
}
The simplest solution is to make use of viewport height(vh) and viewport width(vw) units to set the height and width of the block. this block/div will fill up the entire space in the browser window. Here is an example.
div.container {
height: 100vh;
width: 100vw;
}
make sure you have the viewport meta tag in your <head> as given
<meta name="viewport" content="width=device-width, initial-scale=1.0">
This gives the browser instructions on how to control the page's dimensions and scaling. The width=device-width part sets the width of the page to follow the screen-width of the device (which will vary depending on the device).
The initial-scale=1.0 part sets the initial zoom level when the page is first loaded by the browser. Incase of a missing meta tag, the initial scale and zoom may misbehave. Also put your <p> inside the container div. Here is the working demo.
My code:
HTML, body {
margin: 0;
padding: 0;
}
#container {
width: 100vw;
height: 100vh;
background: purple;
}
p {
height: 100%;
width: 100%;
background-color: rgba(255,255,255, .8);
}
<div id="container"></div>
<div id="container">
<p>
Lorem Ipsum is simply dummy text of the printing and typesetting industry. Lorem Ipsum has been the industry's standard dummy text ever since the 1500s, when an unknown printer took a galley of type and scrambled it to make a type specimen book. It has survived not only five centuries, but also the leap into electronic typesetting, remaining essentially unchanged. It was popularised in the 1960s with the release of Letraset sheets containing Lorem Ipsum passages, and more recently with desktop publishing software like Aldus PageMaker including versions of Lorem Ipsum.
</p>
</div>
I have tried it with those codes and it seems like it's working,
You can check them:
body {
color: red;
background: green;
margin: 0;
padding: 0;
}
#container {
width: 100vw;
height: 100vh;
z-index: 1;
background: purple;
}
p {
font-size: 20pt;
}
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<meta http-equiv="X-UA-Compatible" content="IE=edge">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<title>Document</title>
<link rel="stylesheet" href="main.css">
</head>
<body>
<div id="container"></div>
<p>ksksks</p>
</body>
</html>
Nothing seems to be the problem.
#container {
width: 100vw;
height: 100vh;
background: purple;
}
body {
margin: 0px;
}
#innerDiv {
height: 100px;
background-color: red;
width: 100vw;
}
#innerDiv1 {
height: 100px;
background-color: blue;
width: 100vw;
}
<div id="container">
</div>
<div id="innerDiv">Div #1</div>
<div id="innerDiv1">Div #2</div>
Related
So i created a flexbox like as follow and coloured the border as shown:
and basically what I'm trying to do now is to only let the box flex width wise whenever i resize the browser window which is working by default:
However, what I want now is that I only want it to flex whenever the width of the browser window is adjusted but not when the height of the browser window is adjusted. If i adjust the browser height now, the flexbox responds as such:
Therefore what I want is, whenever the height of the browser is reduced, i want the flexbox height to remain unchanged and make it scrollable height wise hence the scrollbar at the side would show whenever the height is reduced. It's similar to the https://www.apple.com/ website where if we adjust the width of the browser, it flexes but height wise its utilizing the scrollbar.
How do i achieve this?
* {
padding: 0;
margin: 0;
box-sizing: border-box;
}
html, body {
height: 100%;
}
#outer {
border: 1px solid black;
height: 90%;
display: flex;
width: 90%;
}
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<link rel="stylesheet" href = "style.css">
<title>Document</title>
</head>
<body>
<div id = "outer">
</div>
</body>
</html>
Therefore what I want is, whenever the height of the browser is reduced, i want the flexbox height to remain unchanged and make it scrollable height wise hence the scrollbar at the side would show whenever the height is reduced.
Given this requirement, what I would do is
Remove the height: 90%; line in your CSS. This is causing your flexbox to take up 90% of the height of your browser window, even upon resizing.
Add flex-direction: column;
Add some content that takes up more height than your browser window. You mentioned www.apple.com, after all :-)
Watch the vertical scrollbar appear!
HTML:
<body>
<div id = "outer">
<p>Images and text and content, oh my!</p>
<p>Images and text and content, oh my!</p>
<p>Images and text and content, oh my!</p>
</div>
</body>
CSS:
* {
padding: 0;
margin: 0;
box-sizing: border-box;
}
html, body {
height: 100%;
}
#outer {
border: 1px solid black;
display: flex;
flex-direction: column;
width: 90%;
}
p {
font-size: x-large;
border: 1px solid blue;
padding: 300px; /* or other sufficiently large property:value */
}
I am trying to create a full screen slider with a footer on the bottom. Making the slider full screen is easy, but adding a "footer" to it doesn't seem to be (for me). For instance the slider will have a photo and the div below it will have details about the photo, which all should be shown as the "landing page" without scrolling at all, on all devices.
My brain is telling me to create a wrapper container that is 100vh to fill 100% of the views height, and then create the footer - for this example - at a set height of 150px and then have the slider fill the remaining difference left over in the wrapper container, which in theory seems to be right, but I just can't seem to figure out how to actually do it without using scripting. I'm ok with scripts, just wondering if there is a pure css way of doing what I am trying to accomplish.
In this specific example I've tried absolute positioning on the footer div with bottom 0 to hug to the bottom of the main wrapper, which works, sort of (wonky on mobile especially iPhone due to the bottom navigational bar), but naturally due to the way position absolute seems to work, setting 100% height on the slider div will ignore the footer div and set its height to 100% of the wrapper container.
Is it possible to set bottom: 0, yet have the slider div to not overlap the absolute positioned footer div?
Is there a better way to do this all together using pure css? Have I lost my mind?
Here is a diagram of what I am trying to accomplish
Original Code before suggestions
<!doctype html>
<html lang="en">
<head>
<meta charset="utf-8">
<title>test page</title>
<meta name="description" content="test page">
<meta name="author" content="Test">
<style>
body {
margin: 0px;
}
.page-wrapper {
height: 100vh;
background-color: red;
}
.slider {
height: 100%;
background-color: blue;
}
.slider-footer {
height: 150px;
background-color: green;
position: absolute;
bottom: 0;
width: 100%;
}
</style>
</head>
<body>
<div class="page-wrapper">
<div class="slider">
</div>
<div class="slider-footer">
</div>
</div>
</body>
</html>
UPDATE / EDIT
Additionally, as suggested below, calc(100vh -150px) on the .slider works better. It works perfectly well on the desktop, but when pulled up on my iPhone, not so much.
Updated Style Code
<style>
body {
margin: 0px;
}
.page-wrapper {
height: 100vh;
max-height: 100vh;
background-color: red;
}
.slider {
background-color: blue;
height: calc(100vh - 150px);
max-height: calc(100vh - 150px);
}
.slider-footer {
height: 150px;
background-color: green;
position: absolute;
bottom: 0;
width: 100%;
}
</style>
The iPhone seems to be automatically adjusting the view because of the lower navigation buttons of safari on the device. It looks like it stretches the .page-wrapper down further than it should. I tried to prevent this by adding a max-height: 100vh to the .page-wrapper, but that didn't seem to do anything at all
Here is what the page looks like on the iPhone
Things look perfectly fine, just the way they should...
Until you scroll down
Thats when things get a little weird...
It seems like, on safari on iPhone at least, 100vh is taking into account the bottom navigation bar, yet the absolute positioning of the slider.footer is ignoring it and setting it self to the top of safari's bottom navigation bar. I get why apple would do that, because the navigation bar is always there by default until you scroll down, but it is clearly causing an issue with what I am trying to accomplish...
Am I correct to think this is an iPhone / Safari problem, or are my html/css skills just that far off?
I'd do something like:
.slider {
height: calc(100vh - 150px);
}
Hope this helps :)
You could try this:
body {
margin: 0px;
margin-bottom: 150px;
}
Another approach would be:
.page-wrapper { position: relative }
.slider {
position: absolute;
top: 0;
left: 0;
right: 0;
bottom: 150px;
}
Hope this (finally) helps :)
I am building a website to host an online gameserver list for the game Crysis Wars, and have just found out that it's by far easier just to develop the design in Adobe Fireworks, and add the relevant code after.
The current web page that I am designing has a signin box at the center of the page, and it works beautifully.
That is, until we change the size of the browser window.
This is the web page as it normally looks:
It is displayed correctly, but here's the screenshot of when the browser window was resized:
As can be seen, this is an issue with the page, since visitors will have different screen resolutions, and this problem could easily re-occur.
My question is, how can I force these two CSS objects to maintain their position, and never overlap?
This is troublesome since the signin box centers itself on the web page.
The web page can be viewed at crysis-or.eu (please don't berate me for developing on a live website).
HTML Code:
<html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en">
<html>
<head>
<title>Server Portal | Login</title>
<link href="./css/main.css" rel="stylesheet" type="text/css" />
</head>
<body>
<div class="navbar">
</div>
<div class="loginui">
</div>
</body>
</html>
CSS:
body {
width:100%;
margin-left:-0px;
background-color:07080A;
}
body > .loginui {
width:400px;
height:400px;
position: absolute;
top:0;
bottom: 0;
left: 0;
right: 0;
margin: auto;
background:url("http://crysis-or.eu/img/login_b_bg.png") repeat-x;
}
body > .navbar {
width:500px;
height:100px;
position: absolute;
margin-top:50px;
margin-left:100px;
background:url("http://crysis-or.eu/img/navbar.png") repeat-x;
}
I would recommend the following:
Put the nav bar and the login window in separate wrapper-divs that prevent them from overlapping. You can change your HTML to:
<html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en">
<html>
<head>
<title>Server Portal | Login</title>
<link href="./css/main.css" rel="stylesheet" type="text/css" />
</head>
<body>
<header id="top-bar">
<div class="navbar">
</div>
</header>
<section id="main">
<div class="loginui">
</div>
</section>
</body>
</html>
Header and Section act just like Div, the only difference is their semantic significance.
Because the .top-bar and .loginui are no longer direct children of the body, your selectors won't work anymore. Change the CSS selectors to just .top-bar and .loginui instead of body > .top-bar and body > .loginui.
The header needs a specified height, and needs its position to be either 'relative' or 'absolute'. An absolutely positioned child element will be positioned absolutely to whatever the closest parent is that is also absolute, or explicitly relative. The background color is for illustration purposes only, and would be removed for production.
header {
position: relative;
height: 200px;
background-color: red;
}
You want the section to fill as much as it can, so it will need absolute positioning. The trick here, the thing that will fix your problem, is adding a min-height attribute to prevent the section from becoming smaller than its contents, thus allowing overlap.
section {
position: absolute;
top: 200px;
left: 0;
right: 0;
bottom: 0;
min-height: 400px;
background-color: blue;
}
That should work for you. The one problem with this solution is that the login window will be centered with respect to its container, rather than the whole window. It will be 100 pixels lower (one half of the header height) than it is with your current design. In order to fix that, if that's important to you, you would need to use a different method of vertically centering it. Put the top as 50%, then use a negative top margin to compensate for half the height plus half of the height of the header, too. Because it has a fixed height, that's easy: (400px + 200px) / 2 = 300px.
.loginui {
width: 400px;
height: 400px;
position: absolute;
top: 50%;
left: 0;
right; 0;
margin: -300px auto 0;
background: url('path/to/login_b_bg.png');
}
If you add this, it will create a scrollbar when trying to resize the browser instead of laying the elements on top of eachother
body
{
width:100%;
min-width: 950px; //ADD THIS. It sets the minimum browser width before creating a scroll bar.
min-height: 550px; // This does the same thing for a vertical scroll bar.
margin-left:-0px;
background-color:07080A;
overflow-y: scroll; // vertical scroll bar
overflow-x: scroll; //horizontal scroll bar
}
EDIT: ---------------------------------
After looking at your site and playing around a bit, your min-width is not an important factor, just the min height, if you set the values like this, the menus will never overlap.
body
{
width:100%;
height: 100%;
min-height: 750px; // Stops the menus from touching eachother vertically, but they can still line up in the x-direction.
margin-left:-0px;
background-color:07080A;
overflow-y: scroll; // vertical scroll bar
}
I have a page and I want to set up my body to 100% so it can't take the screen size and inside body there's a mainContainer div that weight and height are 90% of the body.
Now, Every time I tried to add a div (LoginInnerContainer) inside and want the div to 30% of the root div and in the middle, for some reason, the body gets longer and the inner container doesn't get in the middle .
Why is this happening and how I can I solve it, while keeping the body the size of the screen? Too bad I don't have enough reputation to post the picture to help understanding what I'm saying.
Here's my HMTL code
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
<link rel="stylesheet" href="<?php URL?> public/css/default.css">
<title></title>
</head>
<body>
<div id="mainContainer">
<header>
</header>
<div id="loginInnerContainer">
<div id="loginLogoContainer"></div>
<div id="loginFormContainer"></div>
</div>
</body>
</html>
and there's my CSS so far but the #loginInnerContainer get in the middle and the page gets longer than I need it.
#mainContainer {
/* height: 590px;*/
height: 90%;
width: 90%;
background-color: white;
margin: 50px;
}
html, body{
height: 100%;
}
html {
background-image:url('../images/wood-dark.png');
height: 100%;
}
body {
width: 100%;
min-height:100%;
display: block;
}
#loginMainContainer{
height: 100%;
padding:auto 0;
}
#loginInnerContainer{
background-color:blue;
width: 100%;
height: 30%;
margin:auto 0 auto 0;
}
first of all i would reset the margin and padding of the whole page:
*
{
margin: 0;
padding: 0;
}
More info.
This way some default paddings and margins will be resetted.
Next thing is that you're using margin for your #loginInnerContainer. Margin is always outside the container, you want to use padding for this. More info here.
Though the page will still be bigger as needed...
This is because your padding will also extends the container. to exclude this you could use box-sizing.
Now you can also set your width and height to 100% of the screen, without paying attention to the padding.
jsFiddle
Hope this helped you :)
I'm trying to "flank" a centered div with some design elements that are absolutely positioned outside the main div's width. I'm getting a scroll bar due to the element on the right, but not the element on the left (IE6/7/8, Chrome, Firefox). How can I get rid of that horizontal scrollbar?
<html>
<head>
<style type="text/css">
html, body {
height: 100%;
width: 100%;
margin: 0;
}
body { text-align: center; }
.wrapper {
margin: 0 auto;
position: relative;
width: 960px;
z-index: 0;
}
.main {
background: #900;
height: 700px;
}
.right, .left {
position: absolute;
height: 100px;
width: 100px;
}
.right {
background: #090;
top: 0px;
left: 960px;
z-index: 1;
}
.left {
background: #009;
top: 0px;
left: -100px;
z-index: 1;
}
</style>
</head>
<body>
<div class="wrapper">
<div class="main"></div>
<div class="left"></div>
<div class="right"></div>
</div>
</body>
</html>
This works in IE6-9, FF3.6, Safari 5, and Chrome 5. Didn't seem to matter what doctype I threw at it(none, xhtml 1 transitional, html5). Hope this helps, that was an interesting problem.
<!DOCTYPE html>
<html>
<head>
<style type="text/css">
html,
body {
margin: 0;
padding: 0;
text-align: center;
}
body {
overflow: auto;
}
#container {
min-width: 960px;
zoom: 1; /*For ie6*/
position: relative; /*For ie6/7*/
overflow: hidden;
margin: 0 auto;
}
#main {
background: #cea;
width: 960px;
margin: 0 auto;
height: 700px;
position: relative;
top: 0;
}
#right,
#left {
position: absolute;
height: 100px;
width: 100px;
top: 0;
z-index: 100;
}
#right {
background: #797;
right: -100px;
}
#left {
background: #590;
left: -100px;
}
</style>
</head>
<body>
<div id="container">
<div id="main">
<div id="left">left</div>
<div id="right">right</div>
</div>
</div>
</body>
</html>
Throwing an overflow-x: hidden on the body tag would work in anything that's not IE6/7... but for those two browsers, you'll need to also add overflow-x: hidden to the html tag.
So use what you have now with this adjustment:
html, body {
height: 100%;
width: 100%;
margin: 0;
*overflow-x: hidden;
}
body { text-align: center; overflow-x: hidden; }
Note that the reason the "*" hack is used in the html, body declaration is because IE8 is unconventional. If you don't use it, IE8 will lose vertical scrollbars as well, not just horizontal. I don't know why. But that solution should be fine.
I was having a similar issue to this and was completely tearing my hair out as I found the solution above didn't quite work for me. I overcome this by creating a div outside of my main container div and using min-width and max-width to come up with a solution.
#boxescontainer {
position: relative;
max-width: 1100px;
min-width: 980px;
}
#boxes {
max-width: 1100px;
min-width: 900px;
height: 142px;
background:url(../grfx/square.png) no-repeat;
background-position: center;
z-index: 100;
}
I found however that I also needed to make the square.png image the size of the div so I made it as a transparent png at 1100px. This was my solution to the problem and hopefully it might help someone else.
On a side note I also had an image on the left side in which I used absolute positioning which didn't have the same scrollbar issue as the right side. Apparently the right and left side do take on different properties from what research I did regarding this matter.
In regards to people using overflow-x:hidden I would have to disagree with this method mainly because you are taking away the users ability to horizontal scroll completely. If your website is designed to be viewed the a 1024px resolution then people who are on an 800px resolution won't be able to see half of your website if you take away the ability to horizontally scroll.
Your body is not set to relative.
Not knowing what you'd like to do with this, I would perhaps set a background image on the body instead.
You're getting a scrollbar only when the viewport's thinner than the main plus that right box, right? (Don't think that was clear to some people.) This is expected browser behavior for content overflow.
Depending on what you want to happen (why do you want it to disappear in this circumstance, if you do?), you could set overflow:hidden on .wrapper. That would always hide it--if you're looking to dynamically display it on some other event, that'll work.
If I'm not mistaken, though, you just don't want it to show when their viewport's only 960px wide. AFAIR you can't do that without some js/jQuery. My suggestion would actually be--especially if you don't want to mess with javascript--if you want this content to be visible at all, accept the scrollbar at narrow widths. It might irk you as a designer, but most people won't notice it, and those who do can still access your content--which is a win, right?
Wrap all the elements in a div, make that div position relative and overflow hidden. It solves this problem every time. :D
If the page language is left-to-right, then the left non-fitting elements don't cause a scrollbar.
Try this:
<html dir="rtl">...</html>
This will change the text direction of the page to Right-To-Left, and now the left div will cause a scrollbar, not the right one.
You can do the same with direction:rtl css property.
If you want your page render to be independent from text direction then you can arrange page elements differently to avoid this.
Old question I know, but may help someone else out. The below expands on James response but works in IE6/7/8/9, FF and Webkit. Yes it uses evil expressions but you can put that in a IE6 specific stylesheet.
#bodyInner {
width: 100%;
min-width: 960px;
overflow: hidden;
width:expression(((document.compatMode && document.compatMode=='CSS1Compat') ? document.documentElement.clientWidth : document.body.clientWidth) > 980 ? "100%" : (((document.compatMode && document.compatMode=='CSS1Compat') ? document.documentElement.clientWidth : document.body.clientWidth) #LT# 980 ? "960px" : "97.5%"));
}
I needed a solution like this too - thanks to all who suggested the 100%-wide wrapper with overlow-x hidden. However, I don't think you have to add the extra #bodyInner div - I've successfully tested it applying the width and overflow attributes directly to body in Safari, Opera, Firefox, Chrome, and IE8.
I have a solution that doesn't work in IE7/IE6, but seems to be fine everywhere else.
Create wrapper (#bodyInner) around everything inside your <body> tag.
Apply this CSS rule:
#bodyInner {
width:100%;
overflow:hidden;
min-width:960px;
}
Too bad you can't just apply this on the <body> element.