纵向表格转为横向表格

走远了吗. 提交于 2019-11-29 00:04:29
<!DOCTYPE html>
<html>
<head>
  <meta charset="utf-8">
  <title>列表格转行表格</title>
  <meta name="renderer" content="webkit">
  <meta http-equiv="X-UA-Compatible" content="IE=edge,chrome=1">
  <meta name="viewport" content="width=device-width, initial-scale=1, maximum-scale=1">
  <link rel="stylesheet" type="text/css" href="js/plugins/layui/css/layui.css" />
  <!-- 注意:如果你直接复制所有代码到本地,上述css路径需要改成你本地的 -->
  <style>
      #tableId  th{
          display: block;
      }
      #tableId thead{
          float: left;
      }
      #tableId  tbody td,#tableId  tbody{
          display: block;
          overflow: hidden;
          white-space: nowrap;
        text-overflow: ellipsis;
      }
      #tableId  tbody{
          font-size: 0;
      }
      #tableId  tbody tr{
          display: inline-block;
          width: 14.285714%;
      }
  </style>
</head>
<body>
   
   
   <div style="padding: 15px;">
           <table class="layui-table" id="tableId">
                   <thead>
                       <tr>
                           <th>header1</th>
                           <th>header2</th>
                           <th>header3</th>
                           <th>header4</th>
                       </tr>
                   </thead>
                   <tbody>
                       <tr>
                           <td>1ersf</td>
                           <td>2</td>
                           <td>3</td>
                           <td>4</td>
                       </tr>
                       <tr>
                           <td>8</td>
                           <td>7</td>
                           <td>6</td>
                           <td>5</td>
                       </tr>
                       <tr>
                           <td>8</td>
                           <td>7</td>
                           <td>6</td>
                           <td>5</td>
                       </tr>
                       <tr>
                           <td>8</td>
                           <td>7</td>
                           <td>6</td>
                           <td>5</td>
                       </tr>
                       <tr>
                           <td>8</td>
                           <td>7</td>
                           <td>6</td>
                           <td>5</td>
                       </tr>
                       <tr>
                           <td>8fdsfsfsfsdfs发生的范德萨</td>
                           <td>7</td>
                           <td>6</td>
                           <td>5</td>
                       </tr>
                       <tr>
                           <td>8</td>
                           <td>7</td>
                           <td>6</td>
                           <td>5</td>
                       </tr>
                   </tbody>
           </table>
   </div>
</body>
</html>

 

标签
易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!