Why TR not taking style?

后端 未结 3 1983
北海茫月
北海茫月 2020-12-28 12:51

CSS

table tr {border-bottom:1px solid #008999}

HTML


   <         
相关标签:
3条回答
  • 2020-12-28 13:15

    Add:

    table
    {
        border-collapse: collapse;
    }
    

    Otherwise tr creates no single block.

    Simple example:

    table
    {
      border: 5px solid #900;
      background: #fff;
    }
    tr
    {
      border: 5px solid #090;
    }
    td
    {
      background: #ccc;
      padding: 5px 0;
    }
    
    table + table
    {
      border-collapse: collapse;
    }
    <table>
      <tr>
        <td>def</td>
        <td>ault</td>
      </tr>
    </table>
    <table>
      <tr>
        <td>coll</td>
        <td>apse</td>
      </tr>
    </table>

    0 讨论(0)
  • 2020-12-28 13:27

    tr by definition wont take border styles. You need to apply it to the td's within it:

    table tr td {border-bottom:1px solid #008999}
    
    0 讨论(0)
  • 2020-12-28 13:35

    Try giving

    table tr th {border-bottom:1px solid #008999}
    

    Then you can use

    table { border-collapse: collapse; }
    table tr {border-bottom:1px solid #008999; }
    

    See The collapsing border model

    0 讨论(0)
提交回复
热议问题