Results 1 to 8 of 8

Thread: Div not 100%?!

  1. #1
    Join Date
    Nov 2006
    Location
    D?sseldorf
    Posts
    2,858
    Tokens
    2,256

    Latest Awards:

    Default Div not 100%?!

    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

    Code:
    <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?

  2. #2
    Join Date
    May 2007
    Posts
    10,481
    Tokens
    3,140

    Latest Awards:

    Default

    I'm not really sure but try setting the body height to 100%. CSS is voodoo ****.
    Chippiewill.


  3. #3
    Join Date
    Jun 2005
    Posts
    2,850
    Tokens
    3,979
    Habbo
    Skynus

    Latest Awards:

    Default

    Quote Originally Posted by Luke View Post
    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

    Code:
    <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:
    Code:
    #main {
    	height: 100%;
            position: absolute;
            top: 0;
            bottom: 0;
            width: 1000px;
            margin: 0 auto;
    	background-color:#FFF;
    }
    Probably should do it.

  4. #4
    Join Date
    May 2007
    Posts
    10,481
    Tokens
    3,140

    Latest Awards:

    Default

    Quote Originally Posted by Skynus View Post
    position: absolute;
    Never, not even once. Just go kill yourself.
    Chippiewill.


  5. #5
    Join Date
    Jun 2005
    Posts
    2,850
    Tokens
    3,979
    Habbo
    Skynus

    Latest Awards:

    Default

    Quote Originally Posted by Chippiewill View Post
    Never, not even once. Just go kill yourself.
    I DID SAY NOT THE BEST WAY. :@

  6. #6
    Join Date
    Jun 2013
    Location
    London
    Posts
    1,245
    Tokens
    2,075
    Habbo
    vls

    Latest Awards:

    Default

    wish i knew wot u wos talkin about i might av been able 2 help u

    moderator alert Edited by Nick (Forum Super Moderator): Please don't post pointlessly.
    Last edited by Nick; 06-12-2013 at 09:30 AM.

  7. #7
    Join Date
    Apr 2012
    Posts
    44
    Tokens
    273

    Default

    HTML Code:
    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;
    }

  8. #8
    Join Date
    Jan 2013
    Location
    localhost
    Posts
    63
    Tokens
    412
    Habbo
    AaidenX

    Latest Awards:

    Default

    <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.

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •