使用bootstrap在全高主体内有多个可滚动的div



我正在尝试使用bootstrap创建一个如图1所示的html布局。

图1

我正在尝试使用bootstrap行col类对布局进行编码,但经过多次尝试,我仍然不知道如何完全使用bootstrap来完成。

如果有人能指导我,那就太好了。

<div class="container"> <div class="row"> <div class="col-sm"> One of three columns </div> <div class="col-sm"> One of three columns </div> <div class="col-sm"> One of three columns </div> </div> </div>

这并不完全是一个答案,我添加它是为了提供更多的想法和指导。因为这是一个非常相对的要求。每个孩子都有很多问题要问,例如,边栏是固定宽度的还是自动的?点击下面的按钮进行测试。

.h-0 {
height: 0 !important;
}
#scrollableSidebar {
width: 200px
}
<link href="https://cdn.jsdelivr.net/npm/bootstrap@5.0.0/dist/css/bootstrap.min.css" rel="stylesheet" integrity="sha384-wEmeIV1mKuiNpC+IOBjI7aAzPcEZeedi5yW5f2yOq55WWLwNGmvvx4Um1vskeMj0" crossorigin="anonymous">
<script src="https://cdn.jsdelivr.net/npm/bootstrap@5.0.0/dist/js/bootstrap.bundle.min.js" integrity="sha384-p34f1UUtsS3wqzfto5wAAmdvj+osOnFyQFpp4Ua3gs/ZVWx6oOypYoCJhGGScy+8" crossorigin="anonymous"></script>
<section class="vh-100 vw-100 overflow-hidden d-flex flex-column">
<header>
<nav id="primaryNav" class="navbar navbar-dark text-white bg-primary">
<div class="container-fluid">
Primary Nav
</div>
</nav>
<nav id="secondaryNav" class="navbar navbar-light bg-light">
<div class="container-fluid">
Secondary Nav
</div>
</nav>
</header>
<section class="flex-fill d-flex align-items-stretch">
<aside class="flex-fill d-flex align-items-stretch">
<section id="fixedSidebar" class="bg-warning d-flex align-items-center">
Fixed Sidebar
</section>
<section id="scrollableSidebar" class="bg-danger d-flex flex-column">
<header class="bg-success text-white">
Fixed Sidebar Title
</header>
<div class="flex-fill overflow-auto h-0">
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>
</section>
</aside>
<article id="scrollableContent" class="bg-danger d-flex flex-column">
<header class="bg-info text-white">
Fixed Content Title
</header>
<div class="flex-fill overflow-auto h-0">
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.
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>
</article>
</section>
</section>

最新更新