0

I already have a css class .table-striped from bootstrap. And now I want to specific the css class to all <table> tag in my page. Without adding .table-striped to all <table> tag <table class="table-striped">. Is there anyway can I do it in a more simple way like this :

table {
   .table-striped
}
rafaelcastrocouto
  • 11,781
  • 3
  • 38
  • 63
Junq
  • 13
  • 2

1 Answers1

0

You can apply the tag for all tables by editing the bootstrap css. Just replace:

  .table-striped { ... } 

with:

table { ... }

If you can't or don't want to edit the css you can apply the class to all tables with the following script:

<script>
  var tables = document.querySelectorAll('table');
  for (var i=0; i<tables.length; i++) tables[i].classList.add('table-striped');
</script>
rafaelcastrocouto
  • 11,781
  • 3
  • 38
  • 63