表格布局----基于bootstrap样式 布局

在实际开发中,我们通过菜鸟教程复制的表格往往不能满足我们的开发需求,样式很难看,而且不能自适应,尤其是需要到处Excel的样式,感觉非常糟糕,这次我就写了一个表单,不足之处,希望大神们多多指教;

代码如下:

<!DOCTYPE html>
 <html>
 <head>
     <title>查询详情</title>
     <meta name="keywords" content=""/>
     <meta name="description" content="">
     <meta charset="utf-8">
        <link rel="stylesheet" href="bootstrap.min.css">
        <link rel="stylesheet" href="style.css">
        <style>
            #cardetail{
                color:#fff;
                font-size:16px;
            }
       .table-header{
         height: 66px;
         font-size: 22px;
         background:rgba(224,226,230,.8); 
       }
       .table-user{
         height: 60px;
         font-size: 20px;
       }
     
       .table-list{
         height:35px;
       }
        </style>
 </head>
 <body class="body-white">
     <!-- 车辆详情部分表格 -->
     <div class="wrapper">
         <div class="table-responsive">
       <table  id="cardetail" class="table table-bordered">
             <tbody>
               <tr class="table-header">
                 <td width="130"><i class="fa fa-pencil"></i>&nbsp;档案编号: </td>
                 <td colspan="24" id="number" name="user[number]">123456996</td>
               </tr>
             </tbody>
         <tbody id="car">
           <tr class="table-user">
                 <td colspan="26">主车信息</td>
               </tr>
           <tr class="table-list">
                 <td>车牌号:</td>
                 <td id="hcardNum">鲁JK345</td>
                 <td>大架号:</td>
                 <td id="hcard" colspan="4">LA9940Zc506FDSS218</td>
                 <td colspan="2">车辆类型:</td>
                 <td id="hcardType" colspan="12">重型货车</td>
               </tr>
               <tr class="table-list">
                 <td>发动机型号:</td>
                 <td id="hcardNum">鲁JK345</td>
                 <td class="tableName" >注册日期:</td>
                 <td id="hcard" colspan="4">2016-06-26</td>
                 <td class="tableName" colspan="2">厂牌型号</td>
                 <td id="hcardType" colspan="12">东风天龙</td>
               </tr>
               <tr class="table-list">
                 <td class="tableName">行驶证到期日期:</td>
                 <td id="hcardNum" colspan="2">2016-05-30</td>
                 <td class="tableName" >运营证到期日期:</td>
                 <td id="hcard" colspan="4">2016-08-30</td>
                 <td class="tableName" colspan="2">车辆状态:</td>
                 <td id="hcardType" colspan="12">正常</td>
               </tr>
               <tr class="table-list">
                 <td>挂靠详情:</td>
                 <td id="hcardNum">挂靠费</td> 
                 <td>150</td>
                 <td id="hcard">审运营费</td>
                 <td>5000</td>
                 <td>委托费</td>
                 <td>3000</td>
                 <td>安全会议费</td>
                 <td>300</td>
                 <td>GPS费</td>
                 <td>600</td>
                 <td>其他</td>
                 <td>500</td>
                 <td>共计</td>
                 <td>60000</td>
               </tr>
               <tr class="table-list">
                 <td class="tableName">挂靠日期:</td>
                 <td id="hcardNum">2016-09-30</td>
                 <td class="tableName">收费日期</td>
                 <td id="hcard" colspan="3">2016-06-30</td>
                 <td class="tableName" colspan="2">挂靠备注</td>
                 <td id="hcardType" colspan="7">********</td>
               </tr>
               <tr class="table-list">
                 <td class="tableName">主车备注:</td>
                 <td id="hcardNum" colspan="26">鲁JK345</td>
               </tr>
               <tr class="table-list">
                 <td class="tableName">商险详情:</td>
                 <td id="hcardNum">投保日期</td>
                 <td class="tableName" colspan="2">2016-06-30至2016-09-30</td>
                 <td id="hcard" colspan="1">金额</td>
                 <td class="tableName" colspan="1">3000</td>
                 <td id="hcardType" colspan="1">保险公司</td>
                 <td id="hcardType" colspan="2">人保</td>
                 <td id="hcardType" colspan="2">代理人</td>
                 <td id="hcardType" colspan="6">张三丰</td>
               </tr>
               <tr class="table-list">
                 <td class="tableName">商险种类:</td>
                 <td id="hcardNum">三者险&nbsp;</td>
                 <td>200</td>
                 <td id="hcard" >车损险&nbsp;</td>
                 <td colspan="2">400</td>
                 <td  id="hcardType">驾驶员险&nbsp;</td>
                 <td id="hcardType" colspan="2">500</td>
                 <td id="hcardType">乘客险&nbsp;</td>
                 <td id="hcardType" colspan="3">300</td>
                 <td id="hcardType">不计免赔险&nbsp;</td>
                 <td id="hcardType" colspan="4">500</td>
               </tr>
               <tr class="table-list">
                 <td class="tableName">强险详情:</td>
                 <td id="hcardNum">投保日期:</td>
                 <td class="tableName" colspan="2">2016-09-30至2015-06-30</td>
                 <td id="hcard">金额</td>
                 <td class="tableName" colspan="1">1300</td>
                 <td id="hcardType" colspan="1">保险公司</td>
                 <td id="hcardType" colspan="2">人保</td>
                 <td id="hcardType" colspan="2"> 代理人</td>
                 <td id="hcardType" colspan="6">上官飞燕</td>
               </tr>
               <tr class="table-list">
                 <td class="tableName">保险备注:</td>
                 <td id="hcardNum" colspan="24">鲁JK345132132123123132</td>
               </tr>
         </tbody>
         <tbody id="guacar">
           <tr class="table-user">
                 <td colspan="26">挂车信息</td>
               </tr>
           <tr class="table-list">
                 <td>车牌号:</td>
                 <td id="hcardNum">鲁JK345</td>
                 <td>大架号:</td>
                 <td id="hcard" colspan="4">LA9940Zc506FDSS218</td>
                 <td colspan="2">车辆类型:</td>
                 <td id="hcardType" colspan="12">重型货车</td>
               </tr>
               <tr class="table-list">
                 <td>发动机型号:</td>
                 <td id="hcardNum">鲁JK345</td>
                 <td class="tableName" colspan="2">注册日期:</td>
                 <td id="hcard" colspan="3">2016-06-26</td>
                 <td class="tableName" colspan="2">厂牌型号</td>
                 <td id="hcardType" colspan="12">东风天龙</td>
               </tr>
               <tr class="table-list">
                 <td class="tableName" colspan="2">行驶证到期日期:</td>
                 <td id="hcardNum" colspan="2">2016-05-30</td>
                 <td class="tableName" colspan="3">运营证到期日期:</td>
                 <td id="hcard" colspan="3">2016-08-30</td>
                 <td class="tableName" colspan="2">车辆状态:</td>
                 <td id="hcardType" colspan="8">正常</td>
               </tr>
               <tr class="table-list">
                 <td>挂靠详情:</td>
                 <td id="hcardNum">挂靠费</td> 
                 <td>150</td>
                 <td id="hcard">审运营费</td>
                 <td>5000</td>
                 <td>委托费</td>
                 <td>3000</td>
                 <td>安全会议费</td>
                 <td>300</td>
                 <td>GPS费</td>
                 <td>600</td>
                 <td>其他</td>
                 <td>500</td>
                 <td>共计</td>
                 <td>60000</td>
               </tr>
               <tr class="table-list">
                 <td class="tableName">挂靠日期:</td>
                 <td id="hcardNum" colspan="3">2016-09-30</td>
                 <td class="tableName" colspan="2">收费日期</td>
                 <td id="hcard" colspan="3">2016-06-30</td>
                 <td class="tableName" colspan="2">挂靠备注</td>
                 <td id="hcardType" colspan="6">********</td>
               </tr>
               <tr class="table-list">
                 <td class="tableName">主车备注:</td>
                 <td id="hcardNum" colspan="26">鲁JK345</td>
               </tr>
               <tr class="table-list">
                 <td class="tableName">商险详情:</td>
                 <td id="hcardNum">投保日期</td>
                 <td class="tableName" colspan="2">2016-06-30至2016-09-30</td>
                 <td id="hcard" colspan="1">金额</td>
                 <td class="tableName" colspan="1">3000</td>
                 <td id="hcardType" colspan="1">保险公司</td>
                 <td id="hcardType" colspan="2">人保</td>
                 <td id="hcardType" colspan="2">代理人</td>
                 <td id="hcardType" colspan="6">张三丰</td>
               </tr>
               <tr class="table-list">
                 <td class="tableName">商险种类:</td>
                 <td id="hcardNum">三者险&nbsp;</td>
                 <td>200</td>
                 <td id="hcard" >车损险&nbsp;</td>
                 <td colspan="2">400</td>
                 <td  id="hcardType" colspan="2">驾驶员险&nbsp;</td>
                 <td id="hcardType" colspan="2">500</td>
                 <td id="hcardType" colspan="2">乘客险&nbsp;</td>
                 <td id="hcardType" >300</td>
                 <td id="hcardType">不计免赔险&nbsp;</td>
                 <td id="hcardType" colspan="4">500</td>
               </tr>
               <tr class="table-list">
                 <td class="tableName">强险详情:</td>
                 <td id="hcardNum">投保日期:</td>
                 <td class="tableName" colspan="2">2016-09-30至2015-06-30</td>
                 <td id="hcard">金额</td>
                 <td class="tableName" colspan="1">1300</td>
                 <td id="hcardType" colspan="1">保险公司</td>
                 <td id="hcardType" colspan="2">人保</td>
                 <td id="hcardType" colspan="2"> 代理人</td>
                 <td id="hcardType" colspan="6">上官飞燕</td>
               </tr>
               <tr class="table-list">
                 <td class="tableName">保险备注:</td>
                 <td id="hcardNum" colspan="24">鲁JK345132132123123132</td>
               </tr>
         </tbody>
         <tbody id="car">
           <tr class="table-user">
                 <td colspan="26">车主信息</td>
               </tr>
           <tr class="table-list">
                 <td>姓名:</td>
                 <td id="hcardNum">张三丰</td>
                 <td>电话:</td>
                 <td id="hcard" colspan="2">187****6129</td>
                 <td colspan="2">备用电话</td>
                 <td id="hcardType" colspan="3">157****6629</td>
                 <td colspan="3">区域</td>
                 <td id="hcardType" colspan="3">济南</td>
               </tr>
               <tr class="table-list">
                 <td class="tableName">身份证号码</td>
                 <td id="hcardNum" colspan="3">6228211994........</td>
                 <td colspan="2">地址</td>
                 <td id="hcard" colspan="10">山东省济南市历城区外滩南区12单元1801</td>
               </tr>
               <tr class="table-list">
                 <td>驾驶员:</td>
                 <td id="hcardNum" colspan="2">张三丰</td> 
                 <td colspan="2">驾驶证号:</td>
                 <td id="hcard" colspan="5">370126198704250714</td>
                 <td colspan="2">上岗证:</td>
                 <td colspan="5">15694921333654</td>
               </tr>
               <tr class="table-list">
                 <td class="tableName">主车备注:</td>
                 <td id="hcardNum" colspan="26">鲁JK345</td>
               </tr>
         </tbody>
       </table>
     </div>
     </div>
   <script type="text/javascript" src="jquery-1.11.0.min.js"></script>
   <script src="js/xlsx.core.min.js"></script>
   <script src="js/blob.js"></script>
   <script src="js/FileSaver.min.js"></script>
   <script src="js/tableexport.js"></script>
   <script>
     $(function(){
       $("table").tableExport({formats:["xlsx","xls","csv","txt"]});
     })
   </script>
 </body>
 </html>

DbhVozhcEZvQGMfR6Pkc-A33RMAoVqH3kdctdDxLPiyS4Q0TxJM8-UtxWlqD_wgOlRaCblXODWOPA_ZLwWvBxfsfxR9Dwn7UD3hxAXJMV8TmrQnq0Z8bf3KpID57M7Vh.png

这里主要用了colspan,但是这个好像也不是太好,不知道大家是怎么去处理的。

相关推荐