inline-block <ul> to get rid of some `width:` properties

Created on 27 January 2012, almost 13 years ago
Updated 2 May 2024, 7 months ago

In the case of a drop-down menu, it would be really cool to inline-block the 3rd (and higher)-level <ul> in order to vertical-align them with their corresponding <li>/<a>.
This CSS property is mostly support nowaday.
Basic sample:
<a>link</a><ul style="display: inline-block"><li>list item</li></ul>

The benefit is : no hardcoded width in order to space <ul> from <a> anymore.
So every 3rd-level <ul> is always correctly aligned and stuck to the 2nd-level <li> whatever the <li> (calculated) width is.
As the width is no more hardcoded, menus entry with longer text length are no more wrapped on two lines.
(that's the real benefit).

In the case of an override of the current CSS, it means, at least :

ul.nice-menu-down ul li {
  /* resets the width value for every <li> of the 2nd level and higher */
  width: auto;
}
ul.nice-menu-down ul,
ul.nice-menu-down ul li.menuparent {
  /* containers adapted to the (inlined) content;
     see https://developer.mozilla.org/en/CSS/max-width */
  width: -moz-max-content;
}
/* restore the default <a> status : inline */
ul.nice-menu-down ul a {
  display: inline;
}
/* inline-block the <ul> */
ul.nice-menu-down ul ul { 
  display: inline-block;
  top: auto;
  left: auto;
  position: relative;
}
✨ Feature request
Status

Closed: outdated

Version

2.0

Component

Code

Created by

πŸ‡«πŸ‡·France drzraf

Live updates comments and jobs are added and updated live.
Sign in to follow issues

Comments & Activities

Not all content is available!

It's likely this issue predates Contrib.social: some issue and comment data are missing.

  • πŸ‡ΊπŸ‡¦Ukraine AstonVictor

    I'm closing it because the issue was created a long time ago without any further steps.

    if you still need it then raise a new one.
    thanks

Production build 0.71.5 2024