troubleshooting Question

Let a submenu resize but with a minimum width which is the same as the parent width.

Avatar of HidDS
HidDSFlag for Netherlands asked on
Web Languages and StandardsCSSHTML
15 Comments1 Solution577 ViewsLast Modified:
Hi all,

   I got a dropdown menu, constructed with list items (see the code snippet for an example).
Now the submenu is below the main item (drop down menu) and this all works fine, but the submenu should be as width as the parent. If items in the submenu are larger then this, the submenu should expand.

I tried "width: 100%" on the submenu ul, which makes the submenu as width as the parent, but doesn't let the submenu expand with larger list items. It also didn't work in IE6. I also tried "min-width: 100%;" but this didn't had any effect.

If this is not possible with pure CSS, a javascript solutions is also welcome.

I'll be watching this thread closely, so if you got any questions or need more information I'm more then happy to provide it.

<ul id="menu">
   <li><a href="#this">Home</a></li>
   <li><a href="#this">Places</a>
         <li><a href="#this">Rotterdam</a></li>
         <li><a href="#this">Amsterdam</a></li>
         <li><a href="#this">And a very long place name.</a></li>
   <li><a href="#this">Next item without submenu</a></li>
Join the community to see this answer!
Join our exclusive community to see this answer & millions of others.
Unlock 1 Answer and 15 Comments.
Join the Community
Learn from the best

Network and collaborate with thousands of CTOs, CISOs, and IT Pros rooting for you and your success.

Andrew Hancock - VMware vExpert
See if this solution works for you by signing up for a 7 day free trial.
Unlock 1 Answer and 15 Comments.
Try for 7 days

”The time we save is the biggest benefit of E-E to our team. What could take multiple guys 2 hours or more each to find is accessed in around 15 minutes on Experts Exchange.

-Mike Kapnisakis, Warner Bros