表格项目太多时,x轴水平滚动条:
设置一个div的overflow-x:scroll,把table放在div中即可。(如果希望元素少时不显示滚动条,元素多时才显示,则使用 overflow-x:auto)
实例:
<!DOCTYPE html>
<html lang="zh-CN">
<head>
<meta charset="UTF-8">
<meta http-equiv="X-UA-Compatible" content="IE=edge">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<title>bootstrap 101</title>
<link rel="stylesheet" href="https://www.52dixiaowo.com/tools/npm/bootstrap@3.4.1/dist/css/bootstrap.min.css">
<script src="https://www.52dixiaowo.com/tools/npm/jquery@1.12.4/dist/jquery.min.js"></script>
<script src="https://www.52dixiaowo.com/tools/npm/bootstrap@3.4.1/dist/js/bootstrap.min.js"></script>
</head>
<body>
<div style="overflow-x: scroll;">
<table class="table table-bordered">
<tr>
<td>11111111111111111</td>
<td>11111111111111111</td>
<td>11111111111111111</td>
<td>11111111111111111</td>
<td>11111111111111111</td>
<td>11111111111111111</td>
</tr>
<tr>
<td>11111111111111111</td>
<td>11111111111111111</td>
<td>11111111111111111</td>
<td>11111111111111111</td>
<td>11111111111111111</td>
<td>11111111111111111</td>
</tr>
<tr>
<td>11111111111111111</td>
<td>11111111111111111</td>
<td>11111111111111111</td>
<td>11111111111111111</td>
<td>11111111111111111</td>
<td>11111111111111111</td>
</tr>
</table>
</div>
</body>
</html>
本篇完,还有疑问?留下评论吧