Сделать карту внутри div прокручиваемой в bootstrap - PullRequest
1 голос
/ 22 января 2020

Как получить прокручиваемую карту в Bootstrap 4, если у меня следующая структура html:

<link rel="stylesheet" href="https://maxcdn.bootstrapcdn.com/bootstrap/4.0.0/css/bootstrap.min.css" integrity="sha384-Gn5384xqQ1aoWXA+058RXPxPg6fy4IWvTNh0E263XmFcJlSAwiGgFAW/dAiS6JXm" crossorigin="anonymous">
<script src="https://code.jquery.com/jquery-3.2.1.slim.min.js" integrity="sha384-KJ3o2DKtIkvYIK3UENzmM7KCkRr/rE9/Qpg6aAZGJwFDMVNA/GpGFF93hXpG5KkN" crossorigin="anonymous"></script>
<script src="https://cdnjs.cloudflare.com/ajax/libs/popper.js/1.12.9/umd/popper.min.js" integrity="sha384-ApNbgh9B+Y1QKtv3Rn7W3mgPxhU9K/ScQsAP7hUibX39j7fakFPskvXusvfa0b4Q" crossorigin="anonymous"></script>
<script src="https://maxcdn.bootstrapcdn.com/bootstrap/4.0.0/js/bootstrap.min.js" integrity="sha384-JZR6Spejh4U02d8jOt6vLEHfe/JQGiRRSQQxSfFWpi1MquVdAyjUar5+76PVCmYl" crossorigin="anonymous"></script>


<div class="wrapper">
  <div class="sidebar">
    ....
  </div>
  <div id="content">
    <nav class="navbar navbar-expand-lg navbar-light bg-light">
      ...
    </nav>
    <div class="card">
      <div class="card-body">
        <h5 class="card-title">Privacy Policy</h5>
        <p class="card-text">Use this page to detail your site's privacy policy.</p>
        <p class="card-text">Use this page to detail your site's privacy policy.</p>
        <p class="card-text">Use this page to detail your site's privacy policy.</p>
        <p class="card-text">Use this page to detail your site's privacy policy.</p>
        <p class="card-text">Use this page to detail your site's privacy policy.</p>
        <p class="card-text">Use this page to detail your site's privacy policy.</p>
        <p class="card-text">Use this page to detail your site's privacy policy.</p>
        <p class="card-text">Use this page to detail your site's privacy policy.</p>
        <p class="card-text">Use this page to detail your site's privacy policy.</p>
        <p class="card-text">Use this page to detail your site's privacy policy.</p>
        <p class="card-text">Use this page to detail your site's privacy policy.</p>
        <p class="card-text">Use this page to detail your site's privacy policy.</p>
        <p class="card-text">Use this page to detail your site's privacy policy.</p>
        <p class="card-text">Use this page to detail your site's privacy policy.</p>
        <p class="card-text">Use this page to detail your site's privacy policy.</p>
        <p class="card-text">Use this page to detail your site's privacy policy.</p>
        <p class="card-text">Use this page to detail your site's privacy policy.</p>
        <p class="card-text">Use this page to detail your site's privacy policy.</p>
        <p class="card-text">Use this page to detail your site's privacy policy.</p>
        <p class="card-text">Use this page to detail your site's privacy policy.</p>
        <p class="card-text">Use this page to detail your site's privacy policy.</p>
        <p class="card-text">Use this page to detail your site's privacy policy.</p>
        <p class="card-text">Use this page to detail your site's privacy policy.</p>
        <p class="card-text">Use this page to detail your site's privacy policy.</p>
        <p class="card-text">Use this page to detail your site's privacy policy.</p>
        <p class="card-text">Use this page to detail your site's privacy policy.</p>
        <p class="card-text">Use this page to detail your site's privacy policy.</p>
        <p class="card-text">Use this page to detail your site's privacy policy.</p>
        <p class="card-text">Use this page to detail your site's privacy policy.</p>
        <p class="card-text">Use this page to detail your site's privacy policy.</p>
        <p class="card-text">Use this page to detail your site's privacy policy.</p>
        <p class="card-text">Use this page to detail your site's privacy policy.</p>
        <p class="card-text">Use this page to detail your site's privacy policy.</p>
        <p class="card-text">Use this page to detail your site's privacy policy.</p>
        <p class="card-text">Use this page to detail your site's privacy policy.</p>
        <p class="card-text">Use this page to detail your site's privacy policy.</p>
        <p class="card-text">Use this page to detail your site's privacy policy.</p>
        <p class="card-text">Use this page to detail your site's privacy policy.</p>
        <p class="card-text">Use this page to detail your site's privacy policy.</p>
        <p class="card-text">Use this page to detail your site's privacy policy.</p>
        <p class="card-text">Use this page to detail your site's privacy policy.</p>
        <p class="card-text">Use this page to detail your site's privacy policy.</p>
        <p class="card-text">Use this page to detail your site's privacy policy.</p>
        <p class="card-text">Use this page to detail your site's privacy policy.</p>
        <p class="card-text">Use this page to detail your site's privacy policy.</p>
        <p class="card-text">Use this page to detail your site's privacy policy.</p>
        <p class="card-text">Use this page to detail your site's privacy policy.</p>
        <p class="card-text">Use this page to detail your site's privacy policy.</p>
        <p class="card-text">Use this page to detail your site's privacy policy.</p>
        <p class="card-text">Use this page to detail your site's privacy policy.</p>
        <p class="card-text">Use this page to detail your site's privacy policy.</p>
        <p class="card-text">Use this page to detail your site's privacy policy.</p>
        <p class="card-text">Use this page to detail your site's privacy policy.</p>
        <p class="card-text">Use this page to detail your site's privacy policy.</p>
        <p class="card-text">Use this page to detail your site's privacy policy.</p>
        <p class="card-text">Use this page to detail your site's privacy policy.</p>
        <p class="card-text">Use this page to detail your site's privacy policy.</p>
        <p class="card-text">Use this page to detail your site's privacy policy.</p>
        <p class="card-text">Use this page to detail your site's privacy policy.</p>
        <p class="card-text">Use this page to detail your site's privacy policy.</p>
        <p class="card-text">Use this page to detail your site's privacy policy.</p>
        <p class="card-text">Use this page to detail your site's privacy policy.</p>
        <p class="card-text">Use this page to detail your site's privacy policy.</p>
        <p class="card-text">Use this page to detail your site's privacy policy.</p>
        <p class="card-text">Use this page to detail your site's privacy policy.</p>
        <p class="card-text">Use this page to detail your site's privacy policy.</p>
        <p class="card-text">Use this page to detail your site's privacy policy.</p>
        <p class="card-text">Use this page to detail your site's privacy policy.</p>
        <p class="card-text">Use this page to detail your site's privacy policy.</p>
        <p class="card-text">Use this page to detail your site's privacy policy.</p>
        <p class="card-text">Use this page to detail your site's privacy policy.</p>
        <p class="card-text">Use this page to detail your site's privacy policy.</p>
        <p class="card-text">Use this page to detail your site's privacy policy.</p>
        <p class="card-text">Use this page to detail your site's privacy policy.</p>
        <p class="card-text">Use this page to detail your site's privacy policy.</p>
        <p class="card-text">Use this page to detail your site's privacy policy.</p>
        <p class="card-text">Use this page to detail your site's privacy policy.</p>
        <p class="card-text">Use this page to detail your site's privacy policy.</p>
        <p class="card-text">Use this page to detail your site's privacy policy.</p>
        <p class="card-text">Use this page to detail your site's privacy policy.</p>
        <p class="card-text">Use this page to detail your site's privacy policy.</p>
        <p class="card-text">Use this page to detail your site's privacy policy.</p>
        <p class="card-text">Use this page to detail your site's privacy policy.</p>
        <p class="card-text">Use this page to detail your site's privacy policy.</p>
        <p class="card-text">Use this page to detail your site's privacy policy.</p>
        <p class="card-text">Use this page to detail your site's privacy policy.</p>
        <p class="card-text">Use this page to detail your site's privacy policy.</p>
        <p class="card-text">Use this page to detail your site's privacy policy.</p>
        <p class="card-text">Use this page to detail your site's privacy policy.</p>
        <p class="card-text">Use this page to detail your site's privacy policy.</p>
        <p class="card-text">Use this page to detail your site's privacy policy.</p>
        <p class="card-text">Use this page to detail your site's privacy policy.</p>
        <p class="card-text">Use this page to detail your site's privacy policy.</p>
        <p class="card-text">Use this page to detail your site's privacy policy.</p>
        <p class="card-text">Use this page to detail your site's privacy policy.</p>
        <p class="card-text">Use this page to detail your site's privacy policy.</p>
        <p class="card-text">Use this page to detail your site's privacy policy.</p>
        <p class="card-text">Use this page to detail your site's privacy policy.</p>
        <p class="card-text">Use this page to detail your site's privacy policy.</p>
        <p class="card-text">Use this page to detail your site's privacy policy.</p>
        <p class="card-text">Use this page to detail your site's privacy policy.</p>
        <p class="card-text">Use this page to detail your site's privacy policy.</p>
        <p class="card-text">Use this page to detail your site's privacy policy.</p>
        <p class="card-text">Use this page to detail your site's privacy policy.</p>
        <p class="card-text">Use this page to detail your site's privacy policy.</p>
        <p class="card-text">Use this page to detail your site's privacy policy.</p>
        <p class="card-text">Use this page to detail your site's privacy policy.</p>
        <p class="card-text">Use this page to detail your site's privacy policy.</p>
        <p class="card-text">Use this page to detail your site's privacy policy.</p>
        <p class="card-text">Use this page to detail your site's privacy policy.</p>
        <p class="card-text">Use this page to detail your site's privacy policy.</p>
        <p class="card-text">Use this page to detail your site's privacy policy.</p>
        <p class="card-text">Use this page to detail your site's privacy policy.</p>
        <p class="card-text">Use this page to detail your site's privacy policy.</p>
        <p class="card-text">Use this page to detail your site's privacy policy.</p>
        <p class="card-text">Use this page to detail your site's privacy policy.</p>
        <p class="card-text">Use this page to detail your site's privacy policy.</p>
        <p class="card-text">Use this page to detail your site's privacy policy.</p>
        <p class="card-text">Use this page to detail your site's privacy policy.</p>
        <p class="card-text">Use this page to detail your site's privacy policy.</p>
        <p class="card-text">Use this page to detail your site's privacy policy.</p>
        <p class="card-text">Use this page to detail your site's privacy policy.</p>
        <p class="card-text">Use this page to detail your site's privacy policy.</p>
        <p class="card-text">Use this page to detail your site's privacy policy.</p>
        <p class="card-text">Use this page to detail your site's privacy policy.</p>
        <p class="card-text">Use this page to detail your site's privacy policy.</p>
        <p class="card-text">Use this page to detail your site's privacy policy.</p>
        <p class="card-text">Use this page to detail your site's privacy policy.</p>
        <p class="card-text">Use this page to detail your site's privacy policy.</p>
        <p class="card-text">Use this page to detail your site's privacy policy.</p>
        <p class="card-text">Use this page to detail your site's privacy policy.</p>
        <p class="card-text">Use this page to detail your site's privacy policy.</p>
        <p class="card-text">Use this page to detail your site's privacy policy.</p>
        <p class="card-text">Use this page to detail your site's privacy policy.</p>
        <p class="card-text">Use this page to detail your site's privacy policy.</p>
        <p class="card-text">Use this page to detail your site's privacy policy.</p>
        <p class="card-text">Use this page to detail your site's privacy policy.</p>
        <p class="card-text">Use this page to detail your site's privacy policy.</p>
        <a href="#" class="btn btn-primary">Go somewhere</a>
      </div>
    </div>
  </div>
</div>

Боковая панель находится слева от экрана, оболочка имеет display: flex для достижения этой цели. Я хочу, чтобы .sidebar не прокручивался, когда содержимое превышало высоту #content. Другими словами, только .card должен быть прокручиваемым, но не #content.

Ответы [ 3 ]

2 голосов
/ 22 января 2020

Используйте следующие стили

.wrapper {
  display: flex;
}
.sidebar {
  height: 100vh;
  overflow-y: auto;
}
#content {
  flex-grow: 1;
}
#content .card {
  overflow-y: auto;
  height: calc(100vh - 40px); /* Total height - heinght of the navbar*/
}

Это похоже на реализацию боковой панели на сайте bootstrap.

.wrapper {
  display: flex;
}

.sidebar {
  width: 200px;
  height: 100vh;
  overflow-y: auto;
}

#content {
  flex-grow: 1;
}

#content .card {
  overflow-y: auto;
  height: calc(100vh - 40px);
  /* Total height - heinght of the navbar*/
}
<link rel="stylesheet" href="https://stackpath.bootstrapcdn.com/bootstrap/4.1.3/css/bootstrap.min.css" integrity="sha384-MCw98/SFnGE8fJT3GXwEOngsV7Zt27NXFoaoApmYm81iuXoPkFOJwJ8ERdknLPMO" crossorigin="anonymous">
<script src="https://code.jquery.com/jquery-3.3.1.slim.min.js" integrity="sha384-q8i/X+965DzO0rT7abK41JStQIAqVgRVzpbzo5smXKp4YfRvH+8abtTE1Pi6jizo" crossorigin="anonymous"></script>
<script src="https://cdnjs.cloudflare.com/ajax/libs/popper.js/1.14.3/umd/popper.min.js" integrity="sha384-ZMP7rVo3mIykV+2+9J3UJ46jBk0WLaUAdn689aCwoqbBJiSnjAK/l8WvCWPIPm49" crossorigin="anonymous"></script>
<script src="https://stackpath.bootstrapcdn.com/bootstrap/4.1.3/js/bootstrap.min.js" integrity="sha384-ChfqqxuZUCnJSK3+MXmPNIyE6ZbWh2IMqE241rYiqJxyMiZ6OW/JmZQ5stwEULTy" crossorigin="anonymous"></script>
<div class="wrapper">
  <div class="sidebar">
    Sidebar <br/> Sidebar <br/> Sidebar <br/> Sidebar <br/> Sidebar <br/> Sidebar <br/> Sidebar <br/> Sidebar <br/> Sidebar <br/> Sidebar <br/> Sidebar <br/> Sidebar <br/> Sidebar <br/> Sidebar <br/> Sidebar <br/> Sidebar <br/>Sidebar <br/> Sidebar <br/>    Sidebar <br/> Sidebar <br/> Sidebar <br/> Sidebar <br/> Sidebar <br/> Sidebar <br/> Sidebar <br/>
  </div>
  <div id="content">
    <nav class="navbar navbar-expand-lg navbar-light bg-light">
      ...
    </nav>
    <div class="card">
      <div class="card-body">
        <h5 class="card-title">Privacy Policy</h5>
        <p class="card-text">Use this page to detail your site's privacy policy.</p>
        <p class="card-text">Use this page to detail your site's privacy policy.</p>
        <p class="card-text">Use this page to detail your site's privacy policy.</p>
        <p class="card-text">Use this page to detail your site's privacy policy.</p>
        <p class="card-text">Use this page to detail your site's privacy policy.</p>
        <p class="card-text">Use this page to detail your site's privacy policy.</p>
        <p class="card-text">Use this page to detail your site's privacy policy.</p>
        <p class="card-text">Use this page to detail your site's privacy policy.</p>
        <p class="card-text">Use this page to detail your site's privacy policy.</p>
        <p class="card-text">Use this page to detail your site's privacy policy.</p>
        <p class="card-text">Use this page to detail your site's privacy policy.</p>
        <p class="card-text">Use this page to detail your site's privacy policy.</p>
        <p class="card-text">Use this page to detail your site's privacy policy.</p>
        <p class="card-text">Use this page to detail your site's privacy policy.</p>
        <p class="card-text">Use this page to detail your site's privacy policy.</p>
        <p class="card-text">Use this page to detail your site's privacy policy.</p>
        <p class="card-text">Use this page to detail your site's privacy policy.</p>
        <p class="card-text">Use this page to detail your site's privacy policy.</p>
        <p class="card-text">Use this page to detail your site's privacy policy.</p>
        <p class="card-text">Use this page to detail your site's privacy policy.</p>
        <p class="card-text">Use this page to detail your site's privacy policy.</p>
        <p class="card-text">Use this page to detail your site's privacy policy.</p>
        <p class="card-text">Use this page to detail your site's privacy policy.</p>
        <p class="card-text">Use this page to detail your site's privacy policy.</p>
        <p class="card-text">Use this page to detail your site's privacy policy.</p>
        <p class="card-text">Use this page to detail your site's privacy policy.</p>
        <p class="card-text">Use this page to detail your site's privacy policy.</p>
        <p class="card-text">Use this page to detail your site's privacy policy.</p>
        <p class="card-text">Use this page to detail your site's privacy policy.</p>
        <p class="card-text">Use this page to detail your site's privacy policy.</p>
        <p class="card-text">Use this page to detail your site's privacy policy.</p>
        <p class="card-text">Use this page to detail your site's privacy policy.</p>
        <p class="card-text">Use this page to detail your site's privacy policy.</p>
        <p class="card-text">Use this page to detail your site's privacy policy.</p>
        <p class="card-text">Use this page to detail your site's privacy policy.</p>
        <p class="card-text">Use this page to detail your site's privacy policy.</p>
        <p class="card-text">Use this page to detail your site's privacy policy.</p>
        <p class="card-text">Use this page to detail your site's privacy policy.</p>
        <p class="card-text">Use this page to detail your site's privacy policy.</p>
        <p class="card-text">Use this page to detail your site's privacy policy.</p>
        <p class="card-text">Use this page to detail your site's privacy policy.</p>
        <p class="card-text">Use this page to detail your site's privacy policy.</p>
        <p class="card-text">Use this page to detail your site's privacy policy.</p>
        <p class="card-text">Use this page to detail your site's privacy policy.</p>
        <p class="card-text">Use this page to detail your site's privacy policy.</p>
        <p class="card-text">Use this page to detail your site's privacy policy.</p>
        <p class="card-text">Use this page to detail your site's privacy policy.</p>
        <p class="card-text">Use this page to detail your site's privacy policy.</p>
        <p class="card-text">Use this page to detail your site's privacy policy.</p>
        <p class="card-text">Use this page to detail your site's privacy policy.</p>
        <p class="card-text">Use this page to detail your site's privacy policy.</p>
        <p class="card-text">Use this page to detail your site's privacy policy.</p>
        <p class="card-text">Use this page to detail your site's privacy policy.</p>
        <p class="card-text">Use this page to detail your site's privacy policy.</p>
        <p class="card-text">Use this page to detail your site's privacy policy.</p>
        <p class="card-text">Use this page to detail your site's privacy policy.</p>
        <p class="card-text">Use this page to detail your site's privacy policy.</p>
        <p class="card-text">Use this page to detail your site's privacy policy.</p>
        <p class="card-text">Use this page to detail your site's privacy policy.</p>
        <p class="card-text">Use this page to detail your site's privacy policy.</p>
        <p class="card-text">Use this page to detail your site's privacy policy.</p>
        <p class="card-text">Use this page to detail your site's privacy policy.</p>
        <p class="card-text">Use this page to detail your site's privacy policy.</p>
        <p class="card-text">Use this page to detail your site's privacy policy.</p>
        <p class="card-text">Use this page to detail your site's privacy policy.</p>
        <p class="card-text">Use this page to detail your site's privacy policy.</p>
        <p class="card-text">Use this page to detail your site's privacy policy.</p>
        <p class="card-text">Use this page to detail your site's privacy policy.</p>
        <p class="card-text">Use this page to detail your site's privacy policy.</p>
        <p class="card-text">Use this page to detail your site's privacy policy.</p>
        <p class="card-text">Use this page to detail your site's privacy policy.</p>
        <p class="card-text">Use this page to detail your site's privacy policy.</p>
        <p class="card-text">Use this page to detail your site's privacy policy.</p>
        <p class="card-text">Use this page to detail your site's privacy policy.</p>
        <p class="card-text">Use this page to detail your site's privacy policy.</p>
        <p class="card-text">Use this page to detail your site's privacy policy.</p>
        <p class="card-text">Use this page to detail your site's privacy policy.</p>
        <p class="card-text">Use this page to detail your site's privacy policy.</p>
        <p class="card-text">Use this page to detail your site's privacy policy.</p>
        <p class="card-text">Use this page to detail your site's privacy policy.</p>
        <p class="card-text">Use this page to detail your site's privacy policy.</p>
        <p class="card-text">Use this page to detail your site's privacy policy.</p>
        <p class="card-text">Use this page to detail your site's privacy policy.</p>
        <p class="card-text">Use this page to detail your site's privacy policy.</p>
        <p class="card-text">Use this page to detail your site's privacy policy.</p>
        <p class="card-text">Use this page to detail your site's privacy policy.</p>
        <p class="card-text">Use this page to detail your site's privacy policy.</p>
        <p class="card-text">Use this page to detail your site's privacy policy.</p>
        <p class="card-text">Use this page to detail your site's privacy policy.</p>
        <p class="card-text">Use this page to detail your site's privacy policy.</p>
        <p class="card-text">Use this page to detail your site's privacy policy.</p>
        <p class="card-text">Use this page to detail your site's privacy policy.</p>
        <p class="card-text">Use this page to detail your site's privacy policy.</p>
        <p class="card-text">Use this page to detail your site's privacy policy.</p>
        <p class="card-text">Use this page to detail your site's privacy policy.</p>
        <p class="card-text">Use this page to detail your site's privacy policy.</p>
        <p class="card-text">Use this page to detail your site's privacy policy.</p>
        <p class="card-text">Use this page to detail your site's privacy policy.</p>
        <p class="card-text">Use this page to detail your site's privacy policy.</p>
        <p class="card-text">Use this page to detail your site's privacy policy.</p>
        <p class="card-text">Use this page to detail your site's privacy policy.</p>
        <p class="card-text">Use this page to detail your site's privacy policy.</p>
        <p class="card-text">Use this page to detail your site's privacy policy.</p>
        <p class="card-text">Use this page to detail your site's privacy policy.</p>
        <p class="card-text">Use this page to detail your site's privacy policy.</p>
        <p class="card-text">Use this page to detail your site's privacy policy.</p>
        <p class="card-text">Use this page to detail your site's privacy policy.</p>
        <p class="card-text">Use this page to detail your site's privacy policy.</p>
        <p class="card-text">Use this page to detail your site's privacy policy.</p>
        <p class="card-text">Use this page to detail your site's privacy policy.</p>
        <p class="card-text">Use this page to detail your site's privacy policy.</p>
        <p class="card-text">Use this page to detail your site's privacy policy.</p>
        <p class="card-text">Use this page to detail your site's privacy policy.</p>
        <p class="card-text">Use this page to detail your site's privacy policy.</p>
        <p class="card-text">Use this page to detail your site's privacy policy.</p>
        <p class="card-text">Use this page to detail your site's privacy policy.</p>
        <p class="card-text">Use this page to detail your site's privacy policy.</p>
        <p class="card-text">Use this page to detail your site's privacy policy.</p>
        <p class="card-text">Use this page to detail your site's privacy policy.</p>
        <p class="card-text">Use this page to detail your site's privacy policy.</p>
        <p class="card-text">Use this page to detail your site's privacy policy.</p>
        <p class="card-text">Use this page to detail your site's privacy policy.</p>
        <p class="card-text">Use this page to detail your site's privacy policy.</p>
        <p class="card-text">Use this page to detail your site's privacy policy.</p>
        <p class="card-text">Use this page to detail your site's privacy policy.</p>
        <p class="card-text">Use this page to detail your site's privacy policy.</p>
        <p class="card-text">Use this page to detail your site's privacy policy.</p>
        <p class="card-text">Use this page to detail your site's privacy policy.</p>
        <p class="card-text">Use this page to detail your site's privacy policy.</p>
        <p class="card-text">Use this page to detail your site's privacy policy.</p>
        <p class="card-text">Use this page to detail your site's privacy policy.</p>
        <p class="card-text">Use this page to detail your site's privacy policy.</p>
        <p class="card-text">Use this page to detail your site's privacy policy.</p>
        <p class="card-text">Use this page to detail your site's privacy policy.</p>
        <p class="card-text">Use this page to detail your site's privacy policy.</p>
        <p class="card-text">Use this page to detail your site's privacy policy.</p>
        <p class="card-text">Use this page to detail your site's privacy policy.</p>
        <p class="card-text">Use this page to detail your site's privacy policy.</p>
        <a href="#" class="btn btn-primary">Go somewhere</a>
      </div>
    </div>
  </div>
</div>
0 голосов
/ 22 января 2020

установить overflow-y свойство равным auto. Вы также можете указать max-height для хранения карты div

style="max-height: 100px; overflow-y:auto"

<link rel="stylesheet" href="https://maxcdn.bootstrapcdn.com/bootstrap/4.0.0/css/bootstrap.min.css" integrity="sha384-Gn5384xqQ1aoWXA+058RXPxPg6fy4IWvTNh0E263XmFcJlSAwiGgFAW/dAiS6JXm" crossorigin="anonymous">
<script src="https://code.jquery.com/jquery-3.2.1.slim.min.js" integrity="sha384-KJ3o2DKtIkvYIK3UENzmM7KCkRr/rE9/Qpg6aAZGJwFDMVNA/GpGFF93hXpG5KkN" crossorigin="anonymous"></script>
<script src="https://cdnjs.cloudflare.com/ajax/libs/popper.js/1.12.9/umd/popper.min.js" integrity="sha384-ApNbgh9B+Y1QKtv3Rn7W3mgPxhU9K/ScQsAP7hUibX39j7fakFPskvXusvfa0b4Q" crossorigin="anonymous"></script>
<script src="https://maxcdn.bootstrapcdn.com/bootstrap/4.0.0/js/bootstrap.min.js" integrity="sha384-JZR6Spejh4U02d8jOt6vLEHfe/JQGiRRSQQxSfFWpi1MquVdAyjUar5+76PVCmYl" crossorigin="anonymous"></script>


<div class="wrapper">
  <div class="sidebar">
    ....
  </div>
  <div id="content">
    <nav class="navbar navbar-expand-lg navbar-light bg-light">
      ...
    </nav>
    <div class="card" style="max-height: 100px; overflow-y:auto">
      <div class="card-body">
        <h5 class="card-title">Privacy Policy</h5>
        <p class="card-text">Use this page to detail your site's privacy policy.</p>
        <p class="card-text">Use this page to detail your site's privacy policy.</p>
        <p class="card-text">Use this page to detail your site's privacy policy.</p>
        <p class="card-text">Use this page to detail your site's privacy policy.</p>
        <p class="card-text">Use this page to detail your site's privacy policy.</p>
        <p class="card-text">Use this page to detail your site's privacy policy.</p>
        <p class="card-text">Use this page to detail your site's privacy policy.</p>
        <p class="card-text">Use this page to detail your site's privacy policy.</p>
        <p class="card-text">Use this page to detail your site's privacy policy.</p>
        <p class="card-text">Use this page to detail your site's privacy policy.</p>
        <p class="card-text">Use this page to detail your site's privacy policy.</p>
        <p class="card-text">Use this page to detail your site's privacy policy.</p>
        <p class="card-text">Use this page to detail your site's privacy policy.</p>
        <p class="card-text">Use this page to detail your site's privacy policy.</p>
        <p class="card-text">Use this page to detail your site's privacy policy.</p>
        <p class="card-text">Use this page to detail your site's privacy policy.</p>
        <p class="card-text">Use this page to detail your site's privacy policy.</p>
        <p class="card-text">Use this page to detail your site's privacy policy.</p>
        <p class="card-text">Use this page to detail your site's privacy policy.</p>
        <p class="card-text">Use this page to detail your site's privacy policy.</p>
        <p class="card-text">Use this page to detail your site's privacy policy.</p>
        <p class="card-text">Use this page to detail your site's privacy policy.</p>
        <p class="card-text">Use this page to detail your site's privacy policy.</p>
        <p class="card-text">Use this page to detail your site's privacy policy.</p>
        <p class="card-text">Use this page to detail your site's privacy policy.</p>
        <p class="card-text">Use this page to detail your site's privacy policy.</p>
        <p class="card-text">Use this page to detail your site's privacy policy.</p>
        <p class="card-text">Use this page to detail your site's privacy policy.</p>
        <p class="card-text">Use this page to detail your site's privacy policy.</p>
        <p class="card-text">Use this page to detail your site's privacy policy.</p>
        <p class="card-text">Use this page to detail your site's privacy policy.</p>
        <p class="card-text">Use this page to detail your site's privacy policy.</p>
        <p class="card-text">Use this page to detail your site's privacy policy.</p>
        <p class="card-text">Use this page to detail your site's privacy policy.</p>
        <p class="card-text">Use this page to detail your site's privacy policy.</p>
        <p class="card-text">Use this page to detail your site's privacy policy.</p>
        <p class="card-text">Use this page to detail your site's privacy policy.</p>
        <p class="card-text">Use this page to detail your site's privacy policy.</p>
        <p class="card-text">Use this page to detail your site's privacy policy.</p>
        <p class="card-text">Use this page to detail your site's privacy policy.</p>
        <p class="card-text">Use this page to detail your site's privacy policy.</p>
        <p class="card-text">Use this page to detail your site's privacy policy.</p>
        <p class="card-text">Use this page to detail your site's privacy policy.</p>
        <p class="card-text">Use this page to detail your site's privacy policy.</p>
        <p class="card-text">Use this page to detail your site's privacy policy.</p>
        <p class="card-text">Use this page to detail your site's privacy policy.</p>
        <p class="card-text">Use this page to detail your site's privacy policy.</p>
        <p class="card-text">Use this page to detail your site's privacy policy.</p>
        <p class="card-text">Use this page to detail your site's privacy policy.</p>
        <p class="card-text">Use this page to detail your site's privacy policy.</p>
        <p class="card-text">Use this page to detail your site's privacy policy.</p>
        <p class="card-text">Use this page to detail your site's privacy policy.</p>
        <p class="card-text">Use this page to detail your site's privacy policy.</p>
        <p class="card-text">Use this page to detail your site's privacy policy.</p>
        <p class="card-text">Use this page to detail your site's privacy policy.</p>
        <p class="card-text">Use this page to detail your site's privacy policy.</p>
        <p class="card-text">Use this page to detail your site's privacy policy.</p>
        <p class="card-text">Use this page to detail your site's privacy policy.</p>
        <p class="card-text">Use this page to detail your site's privacy policy.</p>
        <p class="card-text">Use this page to detail your site's privacy policy.</p>
        <p class="card-text">Use this page to detail your site's privacy policy.</p>
        <p class="card-text">Use this page to detail your site's privacy policy.</p>
        <p class="card-text">Use this page to detail your site's privacy policy.</p>
        <p class="card-text">Use this page to detail your site's privacy policy.</p>
        <p class="card-text">Use this page to detail your site's privacy policy.</p>
        <p class="card-text">Use this page to detail your site's privacy policy.</p>
        <p class="card-text">Use this page to detail your site's privacy policy.</p>
        <p class="card-text">Use this page to detail your site's privacy policy.</p>
        <p class="card-text">Use this page to detail your site's privacy policy.</p>
        <p class="card-text">Use this page to detail your site's privacy policy.</p>
        <p class="card-text">Use this page to detail your site's privacy policy.</p>
        <p class="card-text">Use this page to detail your site's privacy policy.</p>
        <p class="card-text">Use this page to detail your site's privacy policy.</p>
        <p class="card-text">Use this page to detail your site's privacy policy.</p>
        <p class="card-text">Use this page to detail your site's privacy policy.</p>
        <p class="card-text">Use this page to detail your site's privacy policy.</p>
        <p class="card-text">Use this page to detail your site's privacy policy.</p>
        <p class="card-text">Use this page to detail your site's privacy policy.</p>
        <p class="card-text">Use this page to detail your site's privacy policy.</p>
        <p class="card-text">Use this page to detail your site's privacy policy.</p>
        <p class="card-text">Use this page to detail your site's privacy policy.</p>
        <p class="card-text">Use this page to detail your site's privacy policy.</p>
        <p class="card-text">Use this page to detail your site's privacy policy.</p>
        <p class="card-text">Use this page to detail your site's privacy policy.</p>
        <p class="card-text">Use this page to detail your site's privacy policy.</p>
        <p class="card-text">Use this page to detail your site's privacy policy.</p>
        <p class="card-text">Use this page to detail your site's privacy policy.</p>
        <p class="card-text">Use this page to detail your site's privacy policy.</p>
        <p class="card-text">Use this page to detail your site's privacy policy.</p>
        <p class="card-text">Use this page to detail your site's privacy policy.</p>
        <p class="card-text">Use this page to detail your site's privacy policy.</p>
        <p class="card-text">Use this page to detail your site's privacy policy.</p>
        <p class="card-text">Use this page to detail your site's privacy policy.</p>
        <p class="card-text">Use this page to detail your site's privacy policy.</p>
        <p class="card-text">Use this page to detail your site's privacy policy.</p>
        <p class="card-text">Use this page to detail your site's privacy policy.</p>
        <p class="card-text">Use this page to detail your site's privacy policy.</p>
        <p class="card-text">Use this page to detail your site's privacy policy.</p>
        <p class="card-text">Use this page to detail your site's privacy policy.</p>
        <p class="card-text">Use this page to detail your site's privacy policy.</p>
        <p class="card-text">Use this page to detail your site's privacy policy.</p>
        <p class="card-text">Use this page to detail your site's privacy policy.</p>
        <p class="card-text">Use this page to detail your site's privacy policy.</p>
        <p class="card-text">Use this page to detail your site's privacy policy.</p>
        <p class="card-text">Use this page to detail your site's privacy policy.</p>
        <p class="card-text">Use this page to detail your site's privacy policy.</p>
        <p class="card-text">Use this page to detail your site's privacy policy.</p>
        <p class="card-text">Use this page to detail your site's privacy policy.</p>
        <p class="card-text">Use this page to detail your site's privacy policy.</p>
        <p class="card-text">Use this page to detail your site's privacy policy.</p>
        <p class="card-text">Use this page to detail your site's privacy policy.</p>
        <p class="card-text">Use this page to detail your site's privacy policy.</p>
        <p class="card-text">Use this page to detail your site's privacy policy.</p>
        <p class="card-text">Use this page to detail your site's privacy policy.</p>
        <p class="card-text">Use this page to detail your site's privacy policy.</p>
        <p class="card-text">Use this page to detail your site's privacy policy.</p>
        <p class="card-text">Use this page to detail your site's privacy policy.</p>
        <p class="card-text">Use this page to detail your site's privacy policy.</p>
        <p class="card-text">Use this page to detail your site's privacy policy.</p>
        <p class="card-text">Use this page to detail your site's privacy policy.</p>
        <p class="card-text">Use this page to detail your site's privacy policy.</p>
        <p class="card-text">Use this page to detail your site's privacy policy.</p>
        <p class="card-text">Use this page to detail your site's privacy policy.</p>
        <p class="card-text">Use this page to detail your site's privacy policy.</p>
        <p class="card-text">Use this page to detail your site's privacy policy.</p>
        <p class="card-text">Use this page to detail your site's privacy policy.</p>
        <p class="card-text">Use this page to detail your site's privacy policy.</p>
        <p class="card-text">Use this page to detail your site's privacy policy.</p>
        <p class="card-text">Use this page to detail your site's privacy policy.</p>
        <p class="card-text">Use this page to detail your site's privacy policy.</p>
        <p class="card-text">Use this page to detail your site's privacy policy.</p>
        <p class="card-text">Use this page to detail your site's privacy policy.</p>
        <p class="card-text">Use this page to detail your site's privacy policy.</p>
        <p class="card-text">Use this page to detail your site's privacy policy.</p>
        <p class="card-text">Use this page to detail your site's privacy policy.</p>
        <p class="card-text">Use this page to detail your site's privacy policy.</p>
        <p class="card-text">Use this page to detail your site's privacy policy.</p>
        <p class="card-text">Use this page to detail your site's privacy policy.</p>
        <a href="#" class="btn btn-primary">Go somewhere</a>
      </div>
    </div>
  </div>
</div>
0 голосов
/ 22 января 2020

Вы пытались установить следующее в вашей таблице стилей CSS?

.wrapper #content .card{
overflow-y: scroll;}

Это установит свойство прокрутки в направлении y только для выбранной карты. В качестве альтернативы вы можете использовать: <div class="card" style="overflow-y: scroll;">

Добро пожаловать на сайт PullRequest, где вы можете задавать вопросы и получать ответы от других членов сообщества.
...