treehouse : what would you like to learn today?
Web Design Web Development iOS Development

Help needed with drop down menu

  • 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.

  • 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.

  • 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

  • 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?