PDA

View Full Version : Div not 100%?!



Luke
05-12-2013, 01:22 PM
Right, I'll probably look like an idiot but I just can't figure it out..
I want the div to be 100% of the page height but it just won't work:(


<style type="text/css">
body {
margin-left: 0px;
margin-top: 0px;
margin-right: 0px;
margin-bottom: 0px;
background-image: url(bg.png);
background-repeat: repeat-x;
}
#main {
min-height: 100%;
height: auto !important;
height: 100%;
width: 1000px;
margin: 0 auto;
background-color:#FFF;
}
</style>
</head>

<body>
<div id="main"></div>
</body>

Any ideas?

Chippiewill
05-12-2013, 09:43 PM
I'm not really sure but try setting the body height to 100%. CSS is voodoo ****.

Tom
05-12-2013, 10:27 PM
Right, I'll probably look like an idiot but I just can't figure it out..
I want the div to be 100% of the page height but it just won't work:(


<style type="text/css">
body {
margin-left: 0px;
margin-top: 0px;
margin-right: 0px;
margin-bottom: 0px;
background-image: url(bg.png);
background-repeat: repeat-x;
}
#main {
min-height: 100%;
height: auto !important;
height: 100%;
width: 1000px;
margin: 0 auto;
background-color:#FFF;
}
</style>
</head>

<body>
<div id="main"></div>
</body>

Any ideas?

Perhaps not the best way of doing it, but:

#main {
height: 100%;
position: absolute;
top: 0;
bottom: 0;
width: 1000px;
margin: 0 auto;
background-color:#FFF;
}

Probably should do it.

Chippiewill
05-12-2013, 10:40 PM
position: absolute;

Never, not even once. Just go kill yourself.

Tom
05-12-2013, 11:06 PM
Never, not even once. Just go kill yourself.

I DID SAY NOT THE BEST WAY. :@

myles
05-12-2013, 11:08 PM
wish i knew wot u wos talkin about i might av been able 2 help u

Edited by Nick (Forum Super Moderator): Please don't post pointlessly.

Tuts
06-12-2013, 11:39 PM
html, body {
margin: 0;
background-image: url(bg.png);
background-repeat: repeat-x;
height: 100%;
}
#main {
height: 100%;
width: 1000px;
margin: 0 auto;
background-color: red;
}

AaidenX
07-12-2013, 12:56 PM
<style type="text/css">
body {
margin: 0;
padding: 0;
background-image: url(bg.png);
background-repeat: repeat-x;
}
#main {
width: 1000px;
margin: 0 auto;
background-color:#FFF repeat;
}
</style>
</head>

<body>
<div id="main"></div>
</body>

that should do, otherwise try using an image and use repeat.

Want to hide these adverts? Register an account for free!