booatrap中的表格样式

调用bootstrap中的table样式,需要创建完整的table结构

table>thead tbody tfoot>th tr td

下列样式可以全部用到表格中

.table 为table添加基本样式

.table-striped 在tbody内添加斑马条纹

.table-bordered 单元格加边框

.table-hover 鼠标悬停行变色

..table-condensed 使表格更加紧凑

 

案例

<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <meta http-equiv="X-UA-Compatible" content="IE=edge">
    <meta name="viewport" content="width=device-width, initial-scale=1">
    <!-- 上述3个meta标签*必须*放在最前面,任何其他内容都*必须*跟随其后! -->
    <title>首页</title>
    <link href="assets/plugins/bootstrap/css/bootstrap.min.css" type="text/css" rel="stylesheet">
    <link href="assets/plugins/bootstrap/css/bootstrap-theme.min.css" type="text/css" rel="stylesheet">
</head>
<body>
<!--调用bootstrap中的table样式-->
<table class="table table-striped table-bordered table-hover table-condensed">
    <thead>
        <tr>
            <th>标号</th>
            <th>备注</th>
        </tr>
    </thead>
    <tbody>
        <tr>
            <td>11</td>
            <td>11</td>
        </tr>
        <tr>
            <td>22</td>
            <td>22</td>
        </tr>
        <tr>
            <td>33</td>
            <td>33</td>
        </tr>
    </tbody>
    <tfoot></tfoot>
</table>
<!-- HTML5 shim 和 Respond.js 是为了让 IE8 支持 HTML5 元素和媒体查询(media queries)功能 -->
<!-- 警告:通过 file:// 协议(就是直接将 html 页面拖拽到浏览器中)访问页面时 Respond.js 不起作用 -->
<!--[if lt IE 9]>
<script src="https://cdn.jsdelivr.net/npm/html5shiv@3.7.3/dist/html5shiv.min.js"></script>
<script src="https://cdn.jsdelivr.net/npm/respond.js@1.4.2/dest/respond.min.js"></script>
<![endif]-->
<script src="assets/plugins/bootstrap/js/bootstrap.min.js"></script>
<script src="assets/plugins/jquery-3.3.1.js"></script>
</body>
</html>

运行结果

 

 

 

<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<meta http-equiv="X-UA-Compatible" content="IE=edge">
<meta name="viewport" content="width=device-width, initial-scale=1">
<!-- 上述3meta标签**放在最前面,任何其他容都**跟随其后! -->
<title>首页</title>
<link href="assets/plugins/bootstrap/css/bootstrap.min.css" type="text/css" rel="stylesheet">
<link href="assets/plugins/bootstrap/css/bootstrap-theme.min.css" type="text/css" rel="stylesheet">
</head>
<body>
<!--bootstrap中的table-->
<table class="table table-striped table-bordered table-hover table-condensed">
<thead>
<tr>
<th>标号</th>
<th>备注</th>
</tr>
</thead>
<tbody>
<tr>
<td>11</td>
<td>11</td>
</tr>
<tr>
<td>22</td>
<td>22</td>
</tr>
<tr>
<td>33</td>
<td>33</td>
</tr>
</tbody>
<tfoot></tfoot>
</table>
<!-- HTML5 shim Respond.js IE8 支持 HTML5 元素和媒体查询media queries)功能 -->
<!-- 警告:通 file:// 协议(就是直接 html 面拖浏览器中)访问页 Respond.js 不起作用 -->
<!--[if lt IE 9]>
<script src="https://cdn.jsdelivr.net/npm/html5shiv@3.7.3/dist/html5shiv.min.js"></script>
<script src="https://cdn.jsdelivr.net/npm/respond.js@1.4.2/dest/respond.min.js"></script>
<![endif]-->
<script src="assets/plugins/bootstrap/js/bootstrap.min.js"></script>
<script src="assets/plugins/jquery-3.3.1.js"></script>
</body>
</html>
posted @ 2020-07-06 11:27  一笑任逍遥  阅读(172)  评论(0编辑  收藏  举报