当前位置: 移动技术网 > IT编程>开发语言>JavaScript > 使用BootStrap实现表格隔行变色及hover变色并在需要时出现滚动条

使用BootStrap实现表格隔行变色及hover变色并在需要时出现滚动条

2019年03月31日  | 移动技术网IT编程  | 我要评论

废话不多说了,直接给大家贴代码了,具体代码如下所示:

<%@ page language="java" import="java.util.*" pageencoding="utf-8"%>
<html> 
<head>
 <!-- 引入的css压缩文件 -->
 <link rel="stylesheet" type="text/css"
  href="<%=request.getcontextpath()%>/resources/css/bootstrap.min.css">
 </head>
 <body>
 <div class="table-responsive">
  <table class="table table-hover table-bordered">
  <caption>
   边框表格布局
  </caption>
  <thead>
   <tr style="background: silver;">
   <th>
    名称
   </th>
   <th>
    城市
   </th>
   <th>
    密码
   </th>
   <th>
    名称
   </th>
   <th>
    城市
   </th>
   <th>
    密码
   </th>
   </tr>
  </thead>
  <tbody>
   <tr class="success">
   <td>
    tanmay
   </td>
   <td>
    bangalore
   </td>
   <td>
    560001
   </td>
   <td>
    tanmay
   </td>
   <td>
    bangalore
   </td>
   <td>
    560001
   </td>
   </tr>
   <tr class="active">
   <td>
    sachin
   </td>
   <td>
    mumbai
   </td>
   <td>
    400003
   </td>
   <td>
    tanmay
   </td>
   <td>
    bangalore
   </td>
   <td>
    560001
   </td>
   </tr>
   <tr class="warning">
   <td>
    uma
   </td>
   <td>
    pune
   </td>
   <td>
    411027
   </td>
   <td>
    tanmay
   </td>
   <td>
    bangalore
   </td>
   <td>
    560001
   </td>
   </tr>
   <tr class="danger">
   <td>
    uma
   </td>
   <td>
    pune
   </td>
   <td>
    411027
   </td>
   <td>
    tanmay
   </td>
   <td>
    bangalore
   </td>
   <td>
    560001
   </td>
   </tr>
  </tbody>
  </table>
 </div>
 <!-- 最后引入js,提高页面加载速度 ,由于这里用的是bootstrap3,所以jquery文件必须是1.9.1以上版本-->
 <script type="text/javascript" language="javascript"
  src='<%=request.getcontextpath()%>/js/bootstrap/jquery-1.9.1.js'>
</script>
 <!-- 引入的js压缩文件 -->
 <script type="text/javascript" language="javascript"
  src='<%=request.getcontextpath()%>/js/bootstrap/bootstrap.min.js'>
</script>
 </body>
</html>
</pre>
<pre name="code" class="html">

以上所述是小编给大家介绍的使用bootstrap实现表格隔行变色及hover变色并在需要时出现滚动条,希望对大家有所帮助

如对本文有疑问, 点击进行留言回复!!

相关文章:

验证码:
移动技术网