Bootstrap 表响应类
将任何 .table 包装在 .table-responsive 类中,你将使表格在小设备(小于 768px)上水平滚动。当在比 768px 更宽的任何地方观看时,你将不会看到这些表格有任何区别。
要制作一个响应表格,你可以尝试运行以下代码 -
示例
<!DOCTYPE html> <html> <head> <title>Bootstrap Table</title> <link href = "/bootstrap/css/bootstrap.min.css" rel="stylesheet"> <script src = "/scripts/jquery.min.js"></script> <script src = "/bootstrap/js/bootstrap.min.js"></script> </head> <body> <div class = "table-responsive"> <table class = "table"> <thead> <tr> <th>Subject</th> <th>Marks</th> <th>Student</th> </tr> </thead> <tbody> <tr class = "success"> <td>Programming</td> <td>90</td> <td>Amit</td> </tr> <tr class = "active"> <td>Web Dev</td> <td>92</td> <td>Yuvraj</td> </tr> <tr class = "warning"> <td>Science</td> <td>95</td> <td>Sachin</td> </tr> <tr class = "danger"> <td>Economics</td> <td>80</td> <td>Tony</td> </tr> </tbody> </table> </body> </html>
广告