+ Reply to Thread
Page 1 of 2 12 LastLast
Results 1 to 10 of 12

Thread: 100% height with CSS

  1. #1
    Ixonal is offline x10Hosting Member Ixonal is an unknown quantity at this point
    Join Date
    Sep 2008
    Posts
    29

    100% height with CSS

    so yeah, makin a site and trying to get a div to be a left bar that's 100% height. it just seems it's stuck at 100% of the default size of the window, so if the content is larger than that, it won't extend to the new size of the document. any ideas?

    here's the location of the website
    http://www.peacefuloaksbandb.com

    and here's my stylesheet
    Code:
    html {
      height: 100%;
    }
    
    body {
      padding: 0px 0px 0px 0px;
      margin: 0px 0px 0px 0px;
      height: 100%;
    }
    
    a.nav {
      color: green;
      text-decoration: none;
    }
    
    a.nav:hover {
      text-decoration: underline;
    }
    
    span.title {
      font: 20pt bold sans-serif;
    }
    
    #logoDiv {
      position: absolute;
      top: 0px;
      left: 180px;
      width: 600px;
      height: 150px;
    }
    
    #navDiv {
      position: absolute;
      top: 0px;
      left: 0px;
      width: 170px;
      height: inherit;
      min-height: 100%;
      color: green;
      font: 14pt sans-serif;
      text-align: right;
      background-color: #ffe8b1;
      padding-right: 5px;
      border-right: 2px solid #7e531a;
    }
    
    #contentDiv {
      position: absolute;
      top: 165px;
      left: 180px;
      width: 600px;
      font: 11pt sans-serif;
      color: green;
    }

  2. #2
    dyreplus's Avatar
    dyreplus is offline x10Hosting Member dyreplus is an unknown quantity at this point
    Join Date
    Feb 2009
    Location
    California, USA
    Posts
    29

    Re: 100% height with CSS

    I believe you will need some javaScript to determine the innerHeight of the user's browser and then have it dynamically figure out how tall to make the side panel.

    Check this site on liquid design for a tutorial.

    Note: to make it also work in firefox, you need to change the onReload command to

    Code:
    onResize="window.location=window.location;"
    Hope this helps :3
    Kindly give me reputation if I helped you. :happysad:


  3. #3
    Sohail's Avatar
    Sohail is offline x10 Spammer Sohail is an unknown quantity at this point
    Join Date
    Sep 2007
    Location
    London, UK
    Posts
    3,052

    Re: 100% height with CSS

    Why don't you use a specific height then? I would suggest using AJAX to keep it at 100% and make it follow you down the page...

  4. #4
    Ixonal is offline x10Hosting Member Ixonal is an unknown quantity at this point
    Join Date
    Sep 2008
    Posts
    29

    Re: 100% height with CSS

    Quote Originally Posted by Sohail View Post
    Why don't you use a specific height then? I would suggest using AJAX to keep it at 100% and make it follow you down the page...
    well, I suppose I could use javascript to do that, I wouldn't need ajax though unless I wanted to constantly reconstruct the menu. but still, it shouldn't be quite that difficult to do this >.<

  5. #5
    dyreplus's Avatar
    dyreplus is offline x10Hosting Member dyreplus is an unknown quantity at this point
    Join Date
    Feb 2009
    Location
    California, USA
    Posts
    29

    Re: 100% height with CSS

    it SOULDN'T be, no...
    I'm looking at your design and wondering why you need such a thing, anyway, though. Your menu is fine as is... or are you implying you don't want that sidebar colour going all the way down the page and being empty? If so, I think it would be best to just set the height of that area.

    If you plan on having huge content pages... rather than the whole menu following down the page, usually just a floating "TOP" link/image works as well.

    By the way, I recommend adding

    Code:
    margin-left:20px;
    to the #contentDiv in your CSS, so that there is some breathing space in between your navigation and content area.
    Last edited by dyreplus; 03-05-2009 at 03:53 AM.
    Kindly give me reputation if I helped you. :happysad:


  6. #6
    Ixonal is offline x10Hosting Member Ixonal is an unknown quantity at this point
    Join Date
    Sep 2008
    Posts
    29

    Re: 100% height with CSS

    yeah, been thinkin it could use some space, but right now I'm dealing with first things first. dunno if you're seeing the same thing as me, and as they say, a picture is worth a thousand words, so here's 2k for ya

    http://img21.imageshack.us/img21/6320/screenshot1r.jpg

    http://img19.imageshack.us/img19/7052/screenshot2q.jpg

    might just be a matter of different browser or OS, but it's just not goin all the way down for me.

  7. #7
    Anna's Avatar
    Anna is offline I am just me Anna is a name known to allAnna is a name known to all
    Join Date
    Aug 2007
    Location
    Sweden
    Posts
    6,569

    Re: 100% height with CSS

    I'll try to explain how you can deal with that.

    Create one div that will act as a container for all content, including the menu. It should then be the first div opened after the <html> tag and the last one to close just before the </html> tag.

    Then the menu div will extend to be 100% of the (dynamic) height for such container. The outer container should have no margin, and no padding (well you can add that to it if you want, but that would change the look of the site as it is now)
    Do you have trouble reaching your site?
    Check here first: News and Announcements


    Don't forget that x10hosting has an irc server as well. Come and join the fun
    server: irc.x10hosting.com, main channel: #x10hosting
    There's a lot helpful users there if need help building your site

  8. #8
    sourfacedcyclop's Avatar
    sourfacedcyclop is offline x10 Sophmore sourfacedcyclop is an unknown quantity at this point
    Join Date
    Sep 2007
    Posts
    221

    Re: 100% height with CSS

    You could try using position:fixed; on you sidebar.
    "Sanity is nothing but our interpretation of reality"

    http://tswebvisions.com - Portfolio

  9. #9
    dyreplus's Avatar
    dyreplus is offline x10Hosting Member dyreplus is an unknown quantity at this point
    Join Date
    Feb 2009
    Location
    California, USA
    Posts
    29

    Re: 100% height with CSS

    OH! My resolution is HUGE so I didn't notice that... but you want the exact opposite from what I was explaining!

    LadyAnna has your answer, but to put it a more straight-forward way:

    Code:
    <div id="everything">
       <div id="logoDiv"></div>
       <div id="contentDiv"></div>
       <div id="navDiv"></div>
    </div>
    However, this may break because of your position absolute-ing. You can try removing your positioning and replacing it with:
    Code:
    float:left;
    You may need to rearrange your html so that the navigation remains on the left, like so:
    Code:
    <div id="everything">
       <div id="navDiv"></div>
       <div id="logoDiv"></div>
       <div id="contentDiv"></div>
    </div>
    Kindly give me reputation if I helped you. :happysad:


  10. #10
    Anna's Avatar
    Anna is offline I am just me Anna is a name known to allAnna is a name known to all
    Join Date
    Aug 2007
    Location
    Sweden
    Posts
    6,569

    Re: 100% height with CSS

    there's actually another easy solution as well... create an image that is 1 or 2 pixel in height, and your menu + 5 pixels wide, colored as you want your menu to be, and use that as background. css: background url('path/image.gif') repeat-y left;

    that would make the image stay on the left side of the page and fill the left side all the way down.
    Do you have trouble reaching your site?
    Check here first: News and Announcements


    Don't forget that x10hosting has an irc server as well. Come and join the fun
    server: irc.x10hosting.com, main channel: #x10hosting
    There's a lot helpful users there if need help building your site

+ Reply to Thread
Page 1 of 2 12 LastLast

Similar Threads

  1. CSS Errors
    By djcustom in forum Programming Help
    Replies: 2
    Last Post: 01-21-2009, 02:12 PM
  2. help!!!!!
    By lordsofvine in forum Programming Help
    Replies: 1
    Last Post: 10-15-2008, 05:00 AM
  3. can anyone convert a CSS into an IPB skin for me?
    By leafypiggy in forum Programming Help
    Replies: 0
    Last Post: 05-06-2008, 07:41 PM
  4. Drop-Down Menu problems
    By gmshed in forum Programming Help
    Replies: 3
    Last Post: 04-11-2008, 12:33 AM
  5. Getting a Div to stretch the whole height of a page
    By Zenax in forum Scripts & 3rd Party Apps
    Replies: 5
    Last Post: 12-10-2006, 10:16 AM

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
x10hosting free hosting for the masses
dedicated servers