Warning: file_get_contents(/data/phpspider/zhask/data//catemap/3/html/71.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
Html 嵌套列表是否需要最小宽度?_Html_Css - Fatal编程技术网

Html 嵌套列表是否需要最小宽度?

Html 嵌套列表是否需要最小宽度?,html,css,Html,Css,我有一个嵌套列表,如: <ul> <li> <a href="#" class="">Parent Links</a> <!-- Flyoutwrapper is what expands when users hover over the parent links, the contents of flyoutwrapper will be changing, so I can not set a min-w

我有一个嵌套列表,如:

<ul>
    <li>
      <a href="#" class="">Parent Links</a>
      <!-- Flyoutwrapper is what expands when users hover over the parent links, the contents of flyoutwrapper will be changing, so I can not set a min-width or width -->
      <div class="flyoutWrapper">
        <ul class="flyout fourCol">
          <li></li>
          <li></li>
        </ul>
      </div>
    </li>
</ul>
(本工程)


(这不起作用!)

在您的情况下,是的,因为您的
.flyout
子菜单从其父菜单继承了宽度,即您的“婚礼”
li
,它的宽度不为
900px
。如果从弹出按钮
中删除宽度,并将其添加到“weddings”父菜单
li
中,则子菜单将继承相同的宽度,无需显式指定宽度。因此,您的答案是肯定的,您需要为子菜单添加一个宽度以符合其自身的宽度,否则它将从父菜单继承。

谢谢!你对重新构造这个HTML有什么建议,这样我就不必设置显式的宽度了吗?@illusorydeveloper你可以将你的父项
li
解开,它应该取其父项的宽度(当正确清除固定时),然后将你的子项
li
s向左浮动,虽然这会导致不必要的结果,因此您只需添加
最小宽度
,就会有更好的运气,但下面是一个没有任何宽度声明的演示:
#nav .flyout.fourCol { min-width:900px; }
#nav .flyout.fourCol { width:auto; }