CSS position absolute and width of parent container in percent

chris picture chris · May 14, 2013 · Viewed 88.7k times · Source

I'm trying to build a HTML/CSS dropdown menu which is flexible in width. Due to the position:absolute for the second level of the navigation, I don't get the width of the first level. Removing the position:absolute will move all following elements on hover...

How can I solve this?

Here is the code:

See the result here: http://jsfiddle.net/5uf2Y/ Hover "Level one (1)" and you will see, that the second level is not the same size like the first level...

Answer

artSx picture artSx · May 14, 2013

You have forget two elements for display 100%.

Correction here

1st elements forgets it's :