www.webdeveloper.com
Results 1 to 8 of 8

Thread: [RESOLVED] scrolling content div with browser scrollbar

  1. #1
    Join Date
    May 2007
    Posts
    105

    resolved [RESOLVED] scrolling content div with browser scrollbar

    I've been fighting with this for a while now. I'm getting close, but there a just a few quirks I cannot get figured out. I have a centered set-width div with a header, left side nav, and right side content. I want the content to scroll with the browser scrollbar and everything else to stay in place (ie fixed). It's mostly working. I have 10px of margin above the header and my scrolling content should not be able to be seen above the header when it goes up there. I want the whole wrap div to be set to auto height according to the content div with a min-height so it goes down to at least the bottom of the navigation links. But when the content gets longer than the bottom of the window, I want it to have a 10px margin from the bottom of the window and then auto-scroll the content.
    Any help would be greatly appreciated.
    Thanks
    Mike

    I'll just post a link and you can view the HTML/CSS there. Let me know if you want me to post those here.
    http://www.michaelandregina.com/demo/

  2. #2
    Join Date
    Aug 2008
    Location
    NYC
    Posts
    74
    Do you want the scrollbar on the actual div or in the browser window?

  3. #3
    Join Date
    May 2007
    Posts
    105
    I would like the scrollbar to be on the browser window.
    Thanks
    Mike

  4. #4
    Join Date
    May 2007
    Posts
    105
    Anyone have any ideas about this one?
    Thanks
    Mike

  5. #5
    Join Date
    Jul 2010
    Posts
    35

    Some suggestions...

    Mike,

    First off, I was going to suggest that you add closing slashes to your meta, link, and img tags (to make it validate), but you've done that since I last looked at your page!

    Try replacing the first part of your css with this:

    Code:
    * { margin: 0; padding: 0; }
    
    html {
    	background-color:#bbc0cb;
    }
    
    #wrap {
    	width: 742px;
    	border-right: 2px solid #00007D;
    	margin: 0 auto;
    }
    
    #header {
    	position: fixed;
    	width: 744px;
    	height: 106px;
    	background: #bbc0cb url('img/header.gif');
    	padding: 10px 0 0 0;
    }
    
    #navigation {
    	position: fixed;
    	top: 116px;
    	width: 180px;
    	height: 100%;
    	background-color: #000180;
    	color: #ffffff;
    	font-weight: bold;
    	font-size: 14px;
    	font-family: Verdana,Arial,Helvetica,sans-serif;
    	padding: 5px 10px;
    }
    
    #navigation li {
    	list-style-type: none;
    	padding: 5px;
    }
    
    #content {
    	margin: 0 0 0 200px;
    	color: #000066;
    	font-family: Verdana,Arial,Helvetica,sans-serif;
    	font-size: 14px;
    	width: 512px;
    	padding: 10px 10px 12px 10px;
    }
    
    #text {
    	overflow: auto;
    }
    
    #footer {
    	position: fixed;
    	bottom: 0;
    	width: 744px;
    	height: 2px;
    	background: #00007d;
    	border-bottom: 10px solid #bbc0cb;
    }
    Make sure to add
    Code:
    <div id="footer"></div>
    to your html right before you close the #wrap div.

    Sincerely,

    Mr. Baggins
    I don't know half of you half as well as I should like; and I like less than half of you half as well as you deserve.
    - Bilbo Baggins in The Fellowship of the Ring

  6. #6
    Join Date
    Jul 2010
    Posts
    35

    Two things to note -

    1. Don't forget to back up your previous code!

    2. The styles I proposed will require that the webpage be always the height of the browser window; no less, even if the content is less.

    Mr. Baggins
    I don't know half of you half as well as I should like; and I like less than half of you half as well as you deserve.
    - Bilbo Baggins in The Fellowship of the Ring

  7. #7
    Join Date
    May 2007
    Posts
    105
    Awesome Mr. Baggins, that works wonderful! Sorry to be nitpicky here, but is there any way I could add a 10px margin above the whole wrap? I tried just doing it as is and it breaks it pretty good. I've uploaded the new version to http://www.michaelandregina.com/demo/
    Thanks again!
    Mike

    Upadate: Woops, nevermind, I played around with it and got it figured out! Thank you very much. Solved!
    Last edited by dmikester1; 12-29-2010 at 04:49 PM. Reason: figured it out

  8. #8
    Join Date
    Jul 2010
    Posts
    35

    Glad to Be of Use

    No problem! Glad I could help.
    I don't know half of you half as well as I should like; and I like less than half of you half as well as you deserve.
    - Bilbo Baggins in The Fellowship of the Ring

Thread Information

Users Browsing this Thread

There are currently 1 users browsing this thread. (0 members and 1 guests)

Tags for this Thread

Posting Permissions

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



Recent Articles