简体   繁体   English

子ul下拉列表因其父高而被截断

[英]child ul dropdown is cut off because of it's parent height

 <div class="carousel-inner">
   ...
   <ul class="dropdown-menu">
    <li>...</li>
    <li>...</li>
    <li>...</li>
    <li>...</li>
   </ul>
</div>

I have 4 elments in div tag but only 2 are shown. 我在div标签中有4个要素,但仅显示2个。 How can I increase it's height show all dropdown items. 如何增加高度显示所有下拉菜单项。

I have used overflow:auto; 我已经使用了overflow:auto; but this is adding scroll to entire parent element which is not looking good. 但这会将滚动条添加到整个父元素中,效果并不理想。 Also padding-bottom also works here but it extends parent's background behind the dropdwn which is not needed. padding-bottom也可以在此处使用,但是它可以将父级的背景扩展到不需要的dropdwn之后。

fuelux .dropdown-menu {
  position: absolute;
  top: 100%;
  left: 0;
  z-index: 1000;
  width: 23%;
  min-width: 50px;
  display: block;

} }

 .fuelux .carousel-inner {
   position: relative;
   width: 100%;
   overflow: hidden;
   line-height: 1;
 }

I am also facing the same problem until few minutes ago and below is what solved my issue. 直到几分钟前,下面也解决了我的问题,我也面临着同样的问题。

style="min-height:300px;max-height:100%;" style =“ min-height:300px; max-height:100%;”


You need to set the min-height of parent div to expanded child menu height size so that the child menu will be displayed with out cutting off by the parent height. 您需要将父div的min-height设置为扩展的子菜单高度大小,以便显示子菜单时不减去父高度。

We are setting max-height so that CSS won't consider min-height as the default fixed height of the component. 我们正在设置max-height,以便CSS不会将min-height视为组件的默认固定高度。 so that it will expand if you are using any Dynamic loading content like GroupBoxes, Choosen boxes with long list, etc.,. 这样,如果您使用任何动态加载内容(例如GroupBoxes,带有长列表的Choosen框等),它将扩展。

   <div class="carousel-inner" style="min-height:300px;max-height:100%;">
   ...
   <ul class="dropdown-menu">
    <li>...</li>
    <li>...</li>
    <li>...</li>
    <li>...</li>
   </ul>
</div>

Note : For the Menu i am loading 300px is the maximum height required to load complete child menu. 注意:对于菜单,我正在加载300px是加载完整子菜单所需的最大高度。 Check your height of expanded menu size and change it with min-height value to get desired result. 检查扩展菜单大小的高度,并将其更改为最小高度值以获得所需的结果。

Are you setting the height to the div-wrapper? 您是否将高度设置为div包装机?

If yes, drop the height out of the stylesheet and the height is automatically set by the content inside the div-wrapper. 如果是,则将高度从样式表中删除,并且高度将由div包装器中的内容自动设置。

For example: 例如:

Style: 样式:

div {
width: 200px; float: left;
}

ul li {
height: 20px; width: 200px; float: left;
}

when you have 4 elements inside ul, the height of die div-wrapper will be 80px. 当您在ul内部有4个元素时,die div-wrapper的高度将为80px。

I hope i can help you ;) 我希望我能为您提供帮助;)

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM