How to apply CSS to td of particular table?

前端 未结 4 1178
情歌与酒
情歌与酒 2021-01-19 01:00

How to apply CSS to td of one particular table; excluding all other tables in web page?


 <         
相关标签:
4条回答
  • 2021-01-19 01:34

    Just add style below:

    <style type="text/css">
        #ToBeApplied tr td{padding:23px;font-weight:bold}
    </style>
    

    One can limit the CSS application using the parent ahead of the style..

    I hope this will help you achieve what you need!

    0 讨论(0)
  • 2021-01-19 01:37

    Use CSS selectors like,

    #ToBeApplied td {padding:23px;font-weight:bold}
    
    0 讨论(0)
  • 2021-01-19 01:37

    This should work (Assuming that you dont want to specify id for table)

    table.pure-table:first-child td {padding:23px;font-weight:bold}
    

    DEMO

    0 讨论(0)
  • 2021-01-19 01:41

    This is what you want.

    Check out this fiddle.

    #ToBeApplied td {
        padding:23px;
        font-weight:bold
    }
    

    Here is the snippet.

    #ToBeApplied td {
      padding: 23px;
      font-weight: bold
    }
    <table class="pure-table fullWidth" id="ToBeApplied">
      <tbody>
        <tr class="pure-table-odd">
          <td>
            <label>Bank</label>
          </td>
          <td>
            <label>Japha Bank</label>
          </td>
        </tr>
      </tbody>
    </table>
    <table class="pure-table fullWidth" id="NotToBeApplied">
      <tbody>
        <tr class="pure-table-odd">
          <td>
            <label>Bank</label>
          </td>
          <td>
            <label>Japha Bank</label>
          </td>
        </tr>
      </tbody>
    </table>

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