Overriding bootstrap table-striped rows with jquery onclick function

前端 未结 1 1799
暖寄归人
暖寄归人 2020-12-20 06:32

hello everyone. I\'ve used bootstrap 4 table classes to build the table shown in the image, including the table-striped class which gives the table it\'s alternate

相关标签:
1条回答
  • 2020-12-20 07:23

    Use link to your CSS file after link to the bootstrap CSS. For example:

    <head>
        ...
        <link rel="stylesheet" href="https://maxcdn.bootstrapcdn.com/bootstrap/3.3.7/css/bootstrap.min.css" integrity="sha384-BVYiiSIFeK1dGmJRAkycuHAHRg32OmUcww7on3RYdg4Va+PmSTsz/K68vbdEjh4u" crossorigin="anonymous">
        ...
        <link rel="stylesheet" type="text/css" href="mytheme.css">
    </head>
    

    Note, you could add any query string to your CSS-file URL to avoid сaching problem:

    <link rel="stylesheet" href="mytheme.css?version=new">
    

    Also you can use !important rules in your CSS as a last resort.

    .highlight {
      background-color: red !important;
    }
    <link rel="stylesheet" href="https://maxcdn.bootstrapcdn.com/bootstrap/3.3.7/css/bootstrap.min.css" integrity="sha384-BVYiiSIFeK1dGmJRAkycuHAHRg32OmUcww7on3RYdg4Va+PmSTsz/K68vbdEjh4u" crossorigin="anonymous">
    <div class="table-responsive">
      <table class="table table-bordered table-striped">
        <colgroup>
          <col class="col-xs-1">
          <col class="col-xs-7"> </colgroup>
        <thead>
          <tr>
            <th>Class</th>
            <th>Description</th>
          </tr>
        </thead>
        <tbody>
          <tr>
            <th scope="row">Text</th>
            <td>Text</td>
          </tr>
          <tr>
            <th scope="row">Text</th>
            <td>Text</td>
          </tr>
          <tr class="highlight">
            <th scope="row">Text</th>
            <td>highlited row</td>
          </tr>
          <tr>
            <th scope="row">Text</th>
            <td>Text</td>
          </tr>
          <tr>
            <th scope="row">Text</th>
            <td>Text</td>
          </tr>
        </tbody>
      </table>
    </div>

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