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

  • 0
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 0
    评论

“相关推荐”对你有帮助么?

  • 非常没帮助
  • 没帮助
  • 一般
  • 有帮助
  • 非常有帮助
提交
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值