CSS 可滚动卡片引导程序

声明:本页面是StackOverFlow热门问题的中英对照翻译,遵循CC BY-SA 4.0协议,如果您需要使用它,必须同样遵循CC BY-SA许可,注明原文地址和作者信息,同时你必须将它归于原作者(不是我):StackOverFlow 原文地址: http://stackoverflow.com/questions/49818715/
Warning: these are provided under cc-by-sa 4.0 license. You are free to use/share it, But you must attribute it to the original authors (not me): StackOverFlow

提示:将鼠标放在中文语句上可以显示对应的英文。显示中英文
时间:2020-08-30 12:54:38  来源:igfitidea点击:

Scrollable Card bootstrap

cssbootstrap-4

提问by edmond

I am using bootstrap 4. I have 3 columns in a single row. One of the columns contains a list and the other two do not. I want only the column with the list to be scrollable but not the entire container, which means that the scrollbar muss appear only within that column.

我正在使用引导程序 4。我在一行中有 3 列。其中一列包含一个列表,另外两列不包含。我只希望列表中的列是可滚动的,而不是整个容器,这意味着滚动条只出现在该列中。

I would appreciate any help.

我将不胜感激任何帮助。

<div class="row">
<div class="col-sm-4">
  <div class="card">...

<div class="col-sm-4">
  <div class="card">...

<div class="col-sm-4">
  <div class="card">...

</div>

回答by Mick Feller

You could do something like this:

你可以这样做:

<div class="row">
  <div class="col-sm-4">
    <div class="card">...

  <div class="col-sm-4 scroll">
    <div class="card">...

  <div class="col-sm-4">
    <div class="card">...
</div>

then in your css:

然后在你的 css 中:

.scroll {
    max-height: 100px;
    overflow-y: auto;
}

回答by Siddhant Varma

Following from Mick's answer:

继米克的回答之后:

.scroll {
    max-height: 100px;
    overflow-y: scroll;
}