#1
  1. No Profile Picture
    Registered User
    Devshed Newbie (0 - 499 posts)

    Join Date
    Nov 2012
    Posts
    2
    Rep Power
    0

    Question Help with fixed left menu bar


    I am fairly new to CSS and am tasked with building a fixed left menu bar with main scrolling content - not that difficult. The thing I am unsure of is this. I want the left menu to have a scroll bar appear and scroll independently IF enough items are added to cause it to need to but not be there if there are not enough items to warrant it. Is that doable? If so, what is the best approach? thanks!
  2. #2
  3. Contributing User
    Devshed Newbie (0 - 499 posts)

    Join Date
    Aug 2011
    Location
    The Pleiades
    Posts
    294
    Rep Power
    8
    Set the height on the container element of your left menu and also set the overflow to scroll.

    Like so:
    HTML:
    Code:
    <div id="left_menu">
    <ul>
        <li></li>
        <li></li>
        ...
        ...
        ...
        ...
    </ul>
    </div>
    CSS:
    Code:
    #left_menu 
    {
         overflow: scroll;
    }
    You need to set the height so it knows where to start the scroll for the overflow. I took the height off and the div expands and doesn't allow the content to be 'hidden'.

    Regards,

    NM.
  4. #3
  5. No Profile Picture
    Registered User
    Devshed Newbie (0 - 499 posts)

    Join Date
    Nov 2012
    Posts
    2
    Rep Power
    0
    thank you!
    Last edited by Kravvitz; November 28th, 2012 at 09:57 PM. Reason: must we quote the whole post? :p

IMN logo majestic logo threadwatch logo seochat tools logo