微信公众号搜"智元新知"关注
微信扫一扫可直接关注哦!

BootStrap用法

一:引入资源

1、下载:https://getbootstrap.com/

2、复制粘贴至本工程内,在要用到的html页面导入BootStrap的css、js资源

<!-- bootstrap -->
<link rel="stylesheet"
      href="/vendor/bootstrap/css/bootstrap.min.css"/>
<!-- bootstrap -->
<script type="text/javascript" src="/vendor/bootstrap/js/bootstrap.min.js"></script>

二、Bootstrap 表格

Bootstrap 提供了一个清晰的创建表格的布局。下表列出了 Bootstrap 支持的一些表格元素:

标签 描述
<table> 为表格添加基础样式。
<thead> 表格标题行的容器元素(<tr>),用来标识表格列。
<tbody> 表格主体中的表格行的容器元素(<tr>)。
<tr> 一组出现在单行上的表格单元格的容器元素(<td> 或 <th>)。
<td> 认的表格单元格。
<th> 特殊的表格单元格,用来标识列或行(取决于范围和位置)。必须在 <thead> 内使用。
<caption> 关于表格存储内容的描述或总结。

表格类:

描述  
.table 为任意 <table> 添加基本样式 (只有横向分隔线)  
.table-striped 在 <tbody> 内添加斑马线形式的条纹 ( IE8 不支持)  
.table-bordered 为所有表格的单元格添加边框  
.table-hover 在 <tbody> 内的任一行启用鼠标悬停状态  
.table-condensed 让表格更加紧凑  

 

案例1:条纹表格

<table class="table table-striped">
  <caption>条纹表格布局</caption>
  <thead>
    <tr>
      <th>名称</th>
      <th>城市</th>
      <th>邮编</th>
    </tr>
  </thead>
  <tbody>
    <tr>
      <td>Tanmay</td>
      <td>Bangalore</td>
      <td>560001</td>
    </tr>
    <tr>
      <td>Sachin</td>
      <td>Mumbai</td>
      <td>400003</td>
    </tr>
    <tr>
      <td>Uma</td>
      <td>Pune</td>
      <td>411027</td>
    </tr>
  </tbody>
</table>

2、边框表格

<table class="table table-bordered">
  <caption>边框表格布局</caption>
  <thead>
    <tr>
      <th>名称</th>
      <th>城市</th>
      <th>邮编</th>
    </tr>
  </thead>
  <tbody>
    <tr>
      <td>Tanmay</td>
      <td>Bangalore</td>
      <td>560001</td>
    </tr>
    <tr>
      <td>Sachin</td>
      <td>Mumbai</td>
      <td>400003</td>
    </tr>
    <tr>
      <td>Uma</td>
      <td>Pune</td>
      <td>411027</td>
    </tr>
  </tbody>
</table>

3、悬停表格

<table class="table table-hover">

 

菜鸟教程:https://www.runoob.com/bootstrap/bootstrap-tables.html

版权声明:本文内容由互联网用户自发贡献,该文观点与技术仅代表作者本人。本站仅提供信息存储空间服务,不拥有所有权,不承担相关法律责任。如发现本站有涉嫌侵权/违法违规的内容, 请发送邮件至 [email protected] 举报,一经查实,本站将立刻删除。

相关推荐