SitePoint Sponsor

User Tag List

Results 1 to 3 of 3
  1. #1
    SitePoint Member
    Join Date
    Jul 2009
    Posts
    23
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)

    Stopping a drop down horizontal menu from pushing content down

    I'm using javascript to show and hide (via display:none & block) a drop down horizontal menu. But it pushes my content down the page. Can I keep it in a set space so nothing moves when it shows up?

  2. #2
    SitePoint Zealot
    Join Date
    Aug 2009
    Posts
    150
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    you need to set position: absolute for that drop down menu, and position: relative for it's parent if needed. This will take drop down menu element from the flow of the page and it will be placed absolutely on the page position can be set by top, bottom, left, right css properties, or by javascript as well.

  3. #3
    SitePoint Wizard Stomme poes's Avatar
    Join Date
    Aug 2007
    Location
    Netherlands
    Posts
    10,283
    Mentioned
    51 Post(s)
    Tagged
    2 Thread(s)
    igv ++

    In general, a good CSS dropdown menu uses position: absolute and pulls the subs offscreen with a ginormous negative left position or negative left margin, then brought onscreen with left: 0 or left: auto (depending). You can do this with Javascript too. Instead of changing the display state, change the left style coordinate.


Bookmarks

Posting Permissions

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