/    Sign up×
Community /Pin to ProfileBookmark

[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.
[url]http://www.michaelandregina.com/demo/[/url]

to post a comment
CSS

7 Comments(s)

Copy linkTweet thisAlerts:
@mikewgdDec 21.2010 — Do you want the scrollbar on the actual div or in the browser window?
Copy linkTweet thisAlerts:
@dmikester1authorDec 22.2010 — I would like the scrollbar to be on the browser window.

Thanks

Mike
Copy linkTweet thisAlerts:
@dmikester1authorDec 27.2010 — Anyone have any ideas about this one?

Thanks

Mike
Copy linkTweet thisAlerts:
@Mr__BagginsDec 29.2010 — 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;
}[/CODE]


Make sure to add [CODE]<div id="footer"></div>[/CODE] to your html right before you close the #wrap div.

Sincerely,

Mr. Baggins
Copy linkTweet thisAlerts:
@Mr__BagginsDec 29.2010 — 
  • 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
    Copy linkTweet thisAlerts:
    @dmikester1authorDec 29.2010 — 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!
    Copy linkTweet thisAlerts:
    @Mr__BagginsDec 30.2010 — No problem! Glad I could help.
    ×

    Success!

    Help @dmikester1 spread the word by sharing this article on Twitter...

    Tweet This
    Sign in
    Forgot password?
    Sign in with TwitchSign in with GithubCreate Account
    about: ({
    version: 0.1.9 BETA 6.16,
    whats_new: community page,
    up_next: more Davinci•003 tasks,
    coming_soon: events calendar,
    social: @webDeveloperHQ
    });

    legal: ({
    terms: of use,
    privacy: policy
    });
    changelog: (
    version: 0.1.9,
    notes: added community page

    version: 0.1.8,
    notes: added Davinci•003

    version: 0.1.7,
    notes: upvote answers to bounties

    version: 0.1.6,
    notes: article editor refresh
    )...
    recent_tips: (
    tipper: @nearjob,
    tipped: article
    amount: 1000 SATS,

    tipper: @meenaratha,
    tipped: article
    amount: 1000 SATS,

    tipper: @meenaratha,
    tipped: article
    amount: 1000 SATS,
    )...