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
    82
    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 05: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

"

"

X vBulletin 4.2.2 Debug Information

  • Page Generation 0.17345 seconds
  • Memory Usage 2,916KB
  • Queries Executed 15 (?)
More Information
Template Usage (33):
  • (1)SHOWTHREAD
  • (1)ad_footer_end
  • (1)ad_footer_start
  • (1)ad_global_above_footer
  • (1)ad_global_below_navbar
  • (1)ad_global_header1
  • (1)ad_global_header2
  • (1)ad_navbar_below
  • (1)ad_showthread_firstpost_sig
  • (1)ad_showthread_firstpost_start
  • (1)ad_thread_first_post_content
  • (1)ad_thread_last_post_content
  • (2)bbcode_code
  • (1)footer
  • (1)forumjump
  • (1)forumrules
  • (1)gobutton
  • (1)header
  • (1)headinclude
  • (1)headinclude_bottom
  • (8)memberaction_dropdown
  • (1)navbar
  • (4)navbar_link
  • (1)navbar_moderation
  • (1)navbar_noticebit
  • (1)navbar_tabs
  • (2)option
  • (8)postbit
  • (8)postbit_onlinestatus
  • (8)postbit_wrapper
  • (1)spacer_close
  • (1)spacer_open
  • (1)tagbit_wrapper 

Phrase Groups Available (6):
  • global
  • inlinemod
  • postbit
  • posting
  • reputationlevel
  • showthread
Included Files (26):
  • ./showthread.php
  • ./global.php
  • ./includes/class_bootstrap.php
  • ./includes/init.php
  • ./includes/class_core.php
  • ./includes/config.php
  • ./includes/functions.php
  • ./includes/functions_navigation.php
  • ./includes/class_friendly_url.php
  • ./includes/class_hook.php
  • ./includes/class_bootstrap_framework.php
  • ./vb/vb.php
  • ./vb/phrase.php
  • ./includes/functions_facebook.php
  • ./includes/functions_calendar.php
  • ./includes/functions_bigthree.php
  • ./includes/class_postbit.php
  • ./includes/class_bbcode.php
  • ./includes/functions_reputation.php
  • ./includes/functions_notice.php
  • ./packages/vbattach/attach.php
  • ./vb/types.php
  • ./vb/cache.php
  • ./vb/cache/db.php
  • ./vb/cache/observer/db.php
  • ./vb/cache/observer.php 

Hooks Called (73):
  • init_startup
  • friendlyurl_resolve_class
  • init_startup_session_setup_start
  • database_pre_fetch_array
  • database_post_fetch_array
  • init_startup_session_setup_complete
  • global_bootstrap_init_start
  • global_bootstrap_init_complete
  • cache_permissions
  • fetch_postinfo_query
  • fetch_postinfo
  • fetch_threadinfo_query
  • fetch_threadinfo
  • fetch_foruminfo
  • load_show_variables
  • load_forum_show_variables
  • global_state_check
  • global_bootstrap_complete
  • global_start
  • style_fetch
  • global_setup_complete
  • showthread_start
  • showthread_getinfo
  • strip_bbcode
  • friendlyurl_clean_fragment
  • friendlyurl_geturl
  • forumjump
  • cache_templates
  • cache_templates_process
  • template_register_var
  • template_render_output
  • fetch_template_start
  • fetch_template_complete
  • parse_templates
  • fetch_musername
  • notices_check_start
  • notices_noticebit
  • process_templates_complete
  • friendlyurl_redirect_canonical
  • showthread_post_start
  • showthread_query_postids
  • showthread_query
  • bbcode_fetch_tags
  • bbcode_create
  • showthread_postbit_create
  • postbit_factory
  • postbit_display_start
  • postbit_imicons
  • bbcode_parse_start
  • bbcode_parse_complete_precache
  • bbcode_parse_complete
  • postbit_display_complete
  • memberaction_dropdown
  • tag_fetchbit
  • tag_fetchbit_complete
  • forumrules
  • navbits
  • navbits_complete
  • build_navigation_data
  • build_navigation_array
  • check_navigation_permission
  • process_navigation_links_start
  • process_navigation_links_complete
  • set_navigation_menu_element
  • build_navigation_menudata
  • build_navigation_listdata
  • build_navigation_list
  • set_navigation_tab_main
  • set_navigation_tab_fallback
  • navigation_tab_complete
  • fb_like_button
  • showthread_complete
  • page_templates