Bootstrap实现了大量基本样式,包括表格、表单、按钮、图片等。基本的使用方法是通过添加特定的class来实现。
Bootstrap 提供了一个清晰的创建表格的布局。
0x01 表格样式
(1)基本样式:不带边框和分割线:
<!DOCTYPE html> <html lang="zh-cn"> <head> <meta charset="UTF-8"> <meta name="viewport" content="width=device-width, initial-scale=1"> <link href="../../css/bootstrap.min.css" rel="stylesheet"> <script src="http://cdn.bootcss.com/jquery/1.11.1/jquery.min.js"></script> <script src="../../js/bootstrap.min.js"></script> <title>表格</title> </head> <body> <div class="container"> <table class="table"> <tr> <td>序号</td> <td>姓名</td> <td>年龄</td> </tr> <tr> <td>1</td> <td>kikay</td> <td>20</td> </tr> <tr> <td>2</td> <td>Tom</td> <td>18</td> </tr> <tr> <td>1</td> <td>小花</td> <td>21</td> </tr> </table> </div> </body> </html>
(2)样式:table-bordered:为表格带上边框:<table class="table table-bordered table-striped">
(3)样式:table-striped:为表格带上斑马线:<table class="table table-striped">
(4)样式:.table-hover:为鼠标悬浮在表格行上指定不同颜色:<table class="table table-hover">
(5)样式:.table-condensed:使表格更加紧凑:<table class="table table-condensed">
0x02 状态标识
还可以为表格中行或者单元格添加状态样式,比如:
<!DOCTYPE html> <html lang="zh-cn"> <head> <meta charset="UTF-8"> <meta name="viewport" content="width=device-width, initial-scale=1"> <link href="../../css/bootstrap.min.css" rel="stylesheet"> <script src="http://cdn.bootcss.com/jquery/1.11.1/jquery.min.js"></script> <script src="../../js/bootstrap.min.js"></script> <title>带上边框</title> </head> <body> <div class="container"> <table class="table table-bordered table-striped table-hover table-condensed"> <tr class="alert-danger"> <td class=>序号</td> <td>姓名</td> <td>年龄</td> </tr> <tr class="success"> <td>1</td> <td>kikay</td> <td>20</td> </tr> <tr class="alert-warning"> <td>2</td> <td>Tom</td> <td>18</td> </tr> <tr> <td>1</td> <td>小花</td> <td>21</td> </tr> </table> </div> </body> </html>
如果大家还想深入学习,可以点击这里进行学习,再为大家附3个精彩的专题:
以上就是本文的全部内容,希望对大家的学习有所帮助,也希望大家多多支持找一找教程网。