2017-06-02 93 views
0

我想在列表下查找下拉列表,但它会自动为列表创建滚动条和不合适的高度。 enter image description here下拉菜单滚动条问题

enter image description here

虽然有名单上的5个元素,它只是显示一个因为inproper高度的其他的都没有显示,我猜。

这是css代码; enter image description here

注:请告诉我,如果还有什么需要

+0

后的代码作为文本,而不是图像。 – webbm

回答

0

包含的元素可能有默认值(overflow: auto),所以当含量比它的规模更大,它将创建一个滚动条。

只要确保你的元素具有overflow: visible

.div1 { 
 
    overflow: hidden; 
 
} 
 

 
.div2 { 
 
    overflow: visible; 
 
} 
 

 
.div3 { 
 
    overflow: scroll; 
 
} 
 

 
.div4 { 
 
    overflow: auto; 
 
} 
 

 
.inner { 
 
    height: 200px; 
 
    width: 50px; 
 
    background-color: red; 
 
    color: white; 
 
} 
 

 
body { 
 
    display: flex; 
 
    flex-direction: row; 
 
    justify-content: space-around; 
 
} 
 

 
.space { 
 
    width: 80px; 
 
    height: 100px; 
 
    border: 1px solid black; 
 
    background-color: blue; 
 
}
<div class="space div1"> 
 
    <div class="inner">hidden</div> 
 
</div> 
 

 
<div class="space div2"> 
 
    <div class="inner">visible</div> 
 
</div> 
 

 
<div class="space div3"> 
 
    <div class="inner">scroll</div> 
 
</div> 
 

 
<div class="space div4"> 
 
    <div class="inner">auto</div> 
 
</div>

+0

当我删除“overflow-x:auto”时,它起作用。非常感谢! –