作者热门文章
- html - 出于某种原因,IE8 对我的 Sass 文件中继承的 html5 CSS 不友好?
- JMeter 在响应断言中使用 span 标签的问题
- html - 在 :hover and :active? 上具有不同效果的 CSS 动画
- html - 相对于居中的 html 内容固定的 CSS 重复背景?
我的主标签 (<main role="main" class="container">
) 中有 3 列。第一列有一个包含许多行的表格。我希望该列可以垂直滚动,同时在页眉和页脚之间保持拉伸(stretch)。我在我的 CSS 中添加了:
#please-scroll{
height: calc(100% - 110px); overflow-y: scroll
}
但它不起作用。
这是我的代码:
html {
height: 100%;
font-family: sans-serif;
background: #1F1F1F !important; }
body {
font-family: sans-serif;
background-color: #1F1F1F;
height: 100%; }
.container {
min-height: calc(100% - 110px) !important;
margin: 0 auto -33px;
width: 100%; }
body > .container {
padding: 60px 15px 0; }
.nav-item .nav-link span {
border-radius: 10px;
border: 2px solid;
padding: 3px;
font-family: 'Helvetica Neue',Helvetica,Arial,sans-serif;
font-size: 12px; }
#please-scroll{
height: calc(100% - 110px); overflow-y: scroll
}
<!DOCTYPE html>
<html lang="en">
<!-- Latest compiled and minified Bootstrap CSS -->
<head>
<title>My Example</title>
<link rel="stylesheet" href="https://maxcdn.bootstrapcdn.com/bootstrap/4.0.0-alpha.6/css/bootstrap.min.css" integrity="sha384-rwoIResjU2yc3z8GV/NPeZWAv56rSmLldC3R/AZzGRnGxQQKnKkoFVhFQhNUwEyJ" crossorigin="anonymous">
</head>
<body style="overflow-y:hidden;">
<header>
<nav class="navbar navbar-toggleable-md navbar-inverse bg-inverse fixed-top" style="border-bottom: 1px solid #353738">
<button class="navbar-toggler navbar-toggler-right" type="button" data-toggle="collapse" data-target="#navbarsExampleDefault" aria-controls="navbarsExampleDefault" aria-expanded="false" aria-label="Toggle navigation">
<span class="navbar-toggler-icon"></span>
</button>
<a class="navbar-brand" href="#" data-placement="right" data-animation="false" data-toggle="tooltip" title="Aller à Mes Summaries">
My Logo</a>
</nav>
</header>
<!-- Begin page content -->
<main role="main" class="container" >
<div class="row " style=" min-height: 100vh;">
<div class="col-sm-12 col-md-3 " id="please-scroll" style="background: #292b2c; border-right: 1px solid #353738; ">
<table style=" color: #636c72;">
<thead>
<tr>
<th>Firstname</th>
<th>Lastname</th>
</tr>
</thead>
<tbody>
<tr>
<td>John</td>
<td>Doe</td>
</tr>
<tr>
<td>Mary</td>
<td>Moe</td>
</tr>
<tr>
<td>July</td>
<td>Dooley</td>
</tr>
<tr>
<td>John</td>
<td>Doe</td>
</tr>
<tr>
<td>Mary</td>
<td>Moe</td>
</tr>
<tr>
<td>July</td>
<td>Dooley</td>
</tr> <tr>
<td>John</td>
<td>Doe</td>
</tr>
<tr>
<td>Mary</td>
<td>Moe</td>
</tr>
<tr>
<td>July</td>
<td>Dooley</td>
</tr> <tr>
<td>John</td>
<td>Doe</td>
</tr>
<tr>
<td>Mary</td>
<td>Moe</td>
</tr>
<tr>
<td>July</td>
<td>Dooley</td>
</tr> <tr>
<td>John</td>
<td>Doe</td>
</tr>
<tr>
<td>Mary</td>
<td>Moe</td>
</tr>
<tr>
<td>July</td>
<td>Dooley</td>
</tr> <tr>
<td>John</td>
<td>Doe</td>
</tr>
<tr>
<td>Mary</td>
<td>Moe</td>
</tr>
<tr>
<td>July</td>
<td>Dooley</td>
</tr> <tr>
<td>John</td>
<td>Doe</td>
</tr>
<tr>
<td>Mary</td>
<td>Moe</td>
</tr>
<tr>
<td>July</td>
<td>Dooley12</td>
</tr>
</tbody>
</table>
</div>
<div class="col-sm-12 col-md-5" style=" min-height: 100vh;">col</div>
<div class="col-sm-12 col-md-4" style=" min-height: 100vh;">col</div>
</div>
</main>
<footer style="">
<nav class="navbar navbar-toggleable-md navbar-inverse fixed-bottom bg-inverse" style="height: 10%; border-top: 1px solid #353738 ">
</nav>
</footer>
<!-- jQuery library -->
<script src="https://code.jquery.com/jquery-3.1.1.slim.min.js" integrity="sha384-A7FZj7v+d/sdmMqp/nOQwliLvUsJfDHW+k9Omg/a/EheAdgtzNs3hpfag6Ed950n" crossorigin="anonymous"></script>
<script src="https://cdnjs.cloudflare.com/ajax/libs/tether/1.4.0/js/tether.min.js" integrity="sha384-DztdAPBWPRXSA/3eYEEUWrWCy7G5KFbe8fFjk5JAIxUYHKkDx6Qin1DkWx51bBrb" crossorigin="anonymous"></script>
<script src="https://maxcdn.bootstrapcdn.com/bootstrap/4.0.0-alpha.6/js/bootstrap.min.js" integrity="sha384-vBWWzlZJ8ea9aCX4pEW3rVHjgjt7zpkNpZk+02D9phzyeVkE+jo0ieGizqPLForn" crossorigin="anonymous"></script><!-- Initialize Bootstrap functionality -->
<script>
// Initialize tooltip component
$(function () {
$('[data-toggle="tooltip"]').tooltip()
})
// Initialize popover component
$(function () {
$('[data-toggle="popover"]').popover()
})
</script>
</body>
</html>
请帮忙!
最佳答案
尝试用 #please-scroll::替换 CSS
#please-scroll{
height: calc(100vh - 110px);
overflow-y: scroll;
}
关于html - 溢出 : scroll not working in a specific column grid with Bootstrap 4,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/47649920/
我是一名优秀的程序员,十分优秀!