gpt4 book ai didi

css - 是否可以用 css 创建不同的溢出子项?

转载 作者:太空宇宙 更新时间:2023-11-03 17:26:40 25 4
gpt4 key购买 nike

假设我有 div a,其中包含 n div元素 n..b,c;我想要那个div a 将为每个元素 ( overflow: scroll ) 获取滚动条,除了元素 c 应该是 overflow: visible .

我可以只使用 CSS 来实现吗?

为了让您更清楚,这就是我要实现的目标 https://jsfiddle.net/gm6cgyqp/除了 fixed 不响应滚动这一事实。我正在尝试使用引导下拉菜单实现与 native 选择相同的感觉,这就是我遇到此类问题的方式。

最佳答案

是的,这是可以做到的。将 max-height 和 max-width 设置为您想要滚动条的 div。

.wrap {
width: 100%;
}
.a,
.b,
.c,
.d {
max-width: 20%;
overflow: scroll;
display: inline-block;
max-height: 100px;
}
.e {
overflow: visible;
width: 20%;
}
<div class="wrap">
<div class="a">
Lorem Ipsum is simply dummy text of the printing and typesetting industry. Lorem Ipsum has been the industry's standard dummy text ever since the 1500s, when an unknown printer took a galley of type and scrambled it to make a type specimen book. It has
survived not only five centuries, but also the leap into electronic typesetting, remaining essentially unchanged. It was popularised in the 1960s with the release of Letraset sheets containing Lorem Ipsum passages, and more recently with desktop publishing
software like Aldus PageMaker including versions of Lorem Ipsum.
</div>
<div class="b">
Lorem Ipsum is simply dummy text of the printing and typesetting industry. Lorem Ipsum has been the industry's standard dummy text ever since the 1500s, when an unknown printer took a galley of type and scrambled it to make a type specimen book. It has
survived not only five centuries, but also the leap into electronic typesetting, remaining essentially unchanged. It was popularised in the 1960s with the release of Letraset sheets containing Lorem Ipsum passages, and more recently with desktop publishing
software like Aldus PageMaker including versions of Lorem Ipsum.
</div>
<div class="c">
Lorem Ipsum is simply dummy text of the printing and typesetting industry. Lorem Ipsum has been the industry's standard dummy text ever since the 1500s, when an unknown printer took a galley of type and scrambled it to make a type specimen book. It has
survived not only five centuries, but also the leap into electronic typesetting, remaining essentially unchanged. It was popularised in the 1960s with the release of Letraset sheets containing Lorem Ipsum passages, and more recently with desktop publishing
software like Aldus PageMaker including versions of Lorem Ipsum.
</div>
<div class="d">
Lorem Ipsum is simply dummy text of the printing and typesetting industry. Lorem Ipsum has been the industry's standard dummy text ever since the 1500s, when an unknown printer took a galley of type and scrambled it to make a type specimen book. It has
survived not only five centuries, but also the leap into electronic typesetting, remaining essentially unchanged. It was popularised in the 1960s with the release of Letraset sheets containing Lorem Ipsum passages, and more recently with desktop publishing
software like Aldus PageMaker including versions of Lorem Ipsum.
</div>
<div class="e">
Lorem Ipsum is simply dummy text of the printing and typesetting industry. Lorem Ipsum has been the industry's standard dummy text ever since the 1500s, when an unknown printer took a galley of type and scrambled it to make a type specimen book. It has
survived not only five centuries, but also the leap into electronic typesetting, remaining essentially unchanged. It was popularised in the 1960s with the release of Letraset sheets containing Lorem Ipsum passages, and more recently with desktop publishing
software like Aldus PageMaker including versions of Lorem Ipsum.
</div>
</div>

关于css - 是否可以用 css 创建不同的溢出子项?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/31271384/

25 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com