代码之家  ›  专栏  ›  技术社区  ›  tadm123

如何以这种方式构造bootrap表?

  •  2
  • tadm123  · 技术社区  · 6 年前

    enter image description here

    我试过这样做,但我不知道如何在一行中放置两列(英寸,厘米)

    3 回复  |  直到 6 年前
        1
  •  1
  •   Gurmatpal    6 年前
    this code will help you. check the below jsfiddle link
    
        https://jsfiddle.net/Gurmatpal/aq9Laaew/221894/
    
        2
  •  2
  •   Udara Kasun    6 年前

    你试过这样做吗?

    table {
        font-family: arial, sans-serif;
        border-collapse: collapse;
        width: 100%;
    }
    
    td, th {
        border: 1px solid #dddddd;
        text-align: left;
        padding: 8px;
        text-align:center;
    }
    
    .title{
       background-color:red;
    }
    
    .sub-title{
       background-color:lightgreen;
    }
    
    .footer{
      background-color:lightcoral;
    }
    <table>
       <thead>
          <tr class="title">
             <th colspan="7">Size Table</th>
          </tr>
          <tr class="sub-title">
             <th rowspan="2"></th>
             <th colspan="2">Bust</th>
             <th colspan="2">Bust</th>
             <th colspan="2">Bust</th>
          </tr>
          <tr class="sub-title">
             <th>CH</th>
             <th>CM</th>
             <th>CH</th>
             <th>CM</th>
             <th>CH</th>
             <th>CM</th>
          </tr>
       </thead>
       <tbody>
          <tr>
             <td>S</td>
             <td>col1</td>
             <td>col2</td>
             <td>col3</td>
             <td>Col4</td>
             <td>Col5</td>
             <td>Col6</td>
          </tr>
          <tr>
             <td>M</td>
             <td>col1</td>
             <td>col2</td>
             <td>col3</td>
             <td>Col4</td>
             <td>Col5</td>
             <td>Col6</td>
          </tr>
          <tr>
             <td>L</td>
             <td>col1</td>
             <td>col2</td>
             <td>col3</td>
             <td>Col4</td>
             <td>Col5</td>
             <td>Col6</td>
          </tr>
       </tbody>
       <tfoot>
          <tr class="footer">
             <th colspan="7">description</th>
          </tr>
       </tfoot>
    
    </table>
        3
  •  1
  •   Hariom Singh    6 年前

    检查此代码。我想这对你有帮助

    table {
        empty-cells: show;
        border: 1px solid #000;
    }
    
    table td,
    table th {
        min-width: 2em;
        min-height: 2em;
        border: 1px solid #000;
    }
    <table>
        <thead>
            <tr>
                <th rowspan="2"></th>
                <th colspan="2">&nbsp;</th>
                <th colspan="2">&nbsp;</th>
            </tr>
            <tr>
                <th>a</th>
                <th>b</th>
                <th>c</th>
                <th>d</th>
            </tr>
        </thead>
        <tbody>
            <tr>
                <td></td>
                <td>1</td>
                <td>2</td>
                <td>3</td>
                <td>4</td>
             </tr>
        </tbody>
    </table>