Advertisement
Help Keep Boards Alive. Support us by going ad free today. See here: https://subscriptions.boards.ie/.
https://www.boards.ie/group/1878-subscribers-forum

Private Group for paid up members of Boards.ie. Join the club.
Hi all, please see this major site announcement: https://www.boards.ie/discussion/2058427594/boards-ie-2026

vertically locked div

  • 26-02-2008 05:05PM
    #1
    Closed Accounts Posts: 975 ✭✭✭


    Not quite sure how to phrase this.

    I'm looking for a way to make a div fixed in a vertical position, so it "follows" you when you scroll up or down, a bit like the css directive background-attachment: scroll.

    My googling prowess has failed me on this one, as I'm not sure what to search for.


Comments

  • Subscribers Posts: 9,716 ✭✭✭CuLT


    Pretty sure you're going to need javascript to do this if you mean what I think you do. (like the navigation on this site.)

    Just running out the door now, but I imagine that should help your googling.


  • Registered Users, Registered Users 2 Posts: 68,173 ✭✭✭✭seamus


    Use CSS

    position: fixed

    Should sort it. Apparently it's an issue in IE6 though, which means you may have to add a hack for MS users.


  • Registered Users, Registered Users 2 Posts: 8,488 ✭✭✭Goodshape


    CSS... you're looking for position : fixed; ...something like :

    position : fixed;
    left : 10px;
    top : 20px;
    bottom : 20px;
    width : 150px;


  • Closed Accounts Posts: 975 ✭✭✭squibs


    position: fixed was what I was looking for alright. Never had a use for it before, so I forgot it existed. Thanks!

    This gives me further ideas - can the scrolling be constrained to the vertical space available within the containing div? That is to say header/content/footer layout - could a scrolling div in the content area be forced to stop once its top hit the header or its bottom hit the footer?


Advertisement
Advertisement