Bootstrap 4 卡水平滚动问题? [英] Bootstrap 4 card horizontal Scroll issue?
问题描述
我正在使用引导卡在下面创建基本的图像和文本.决定使用卡类,因为它的结构非常好,不想使用太多的 css 来制作水平的 div 列表.我想要的是像这样水平滚动的图片库
问题是卡片行为会随着我添加更多卡片而变小.这里有什么问题?,也许我不应该使用卡组?.也许必须废弃引导程序并编写自己的程序?
.card-group {溢出-x:滚动;空白:nowrap;最大宽度:30rem;填充:1rem;}
<html lang="zh-cn"><头><meta charset="UTF-8"><meta name="viewport" content="width=device-width, initial-scale=1.0"><meta http-equiv="X-UA-Compatible" content="ie=edge"><title>文档</title><script src="https://code.jquery.com/jquery-3.3.1.js"integrity="sha256-2Kok7MbOyxpgUVvAk/HJ2jigOSYS2auK4Pfzbm7uH60="crossorigin="anonymous"></script><script src="https://stackpath.bootstrapcdn.com/bootstrap/4.1.3/js/bootstrap.min.js"integrity="sha384-ChfqqxuZUCnJSK3+MXmPNIyE6ZbWh2IMqE241rYiqJxyMiZ6OW/JmZQ5stwEULTcrossorigin="匿名"></script><script src="https://cdnjs.cloudflare.com/ajax/libs/popper.js/1.14.3/umd/popper.min.js"integrity="sha384-ZMP7rVo3mIykV+2+9J3UJ46jBk0WLaUAdn689aCwoqbBJiWWPlvC"crossorigin="匿名"></script><script src="./index.js"></script><link rel="stylesheet" href="https://stackpath.bootstrapcdn.com/bootstrap/4.1.3/css/bootstrap.min.css"integrity="sha384-MCw98/SFnGE8fJT3GXwEOngsV7Zt27NXFoaoApmYm81iuXoPkFOJwJ8ER"crossorigin="匿名">头部><身体><div class="container mt-4"><div class="horzontal-scrollgallery"><div class="card-group"><div class="card pr-3"><img class="card-img-top" src="./images/chicago.jpg" alt="卡片图片"><div class="card-body text-center"><h4 class="card-title">John Doe</h4>
<div class="card pr-3"><img class="card-img-top" src="./images/chicago.jpg" alt="卡片图片"><div class="card-body text-center"><h4 class="card-title">John Doe</h4>
<div class="card pr-3"><img class="card-img-top" src="./images/chicago.jpg" alt="卡片图片"><div class="card-body text-center"><h4 class="card-title">John Doe</h4>