Grow your CSS skills. Land your dream job.

Help needed with drop down menu

  • # September 25, 2012 at 7:00 am

    Hi! I’m building a drop down menu for my project.
    The problem is that _ul_ elements with absolute positioning which shows on :hover are not centered under parent _li_ elements as they should be.

    I’ve tried to add “left”/”right” to css but with no luck.
    Codepen: http://codepen.io/anon/pen/tkfJH

    I’ll be glad if anyone can help. Thanks.

    # September 25, 2012 at 7:06 am

    I’m not sure what you are after.

    If you want to center the list items under the parent EVEN THOUGH they are wider…I don’t think you can do that.

    # September 25, 2012 at 7:18 am

    So the problem is width, ok. How to make parent element remain width: auto, and not loose “vertical rectangle” form of the items that shows on hover?

    If I set width: auto; to them, they are not displayed correctly. – http://codepen.io/anon/pen/tkfJH

    # September 25, 2012 at 7:33 am

    You might want to put widths on the ‘a’ links rather than the list items.

    http://codepen.io/Paulie-D/pen/dgqal

    I’m still having trouble trying to figure out what it is supposed to look like. Do you have a mock-up image?

Viewing 4 posts - 1 through 4 (of 4 total)

You must be logged in to reply to this topic.

*May or may not contain any actual "CSS" or "Tricks".