Using Bootstrap, how do you color individual table rows or cells?

Experience Level: Junior
Tags: Bootstrap 4

Answer

In order to create a table with individually colored rows or cells, use standard html tags <table>, <tr>, <th> and <td>. Then add a class table-primary to the <tr> tag or <td> tag.

Bootstrap table with colored row
<table class="table">
  <tr>
    <th>ID</th>
	<th>Name</th>
  </tr>
  <tr class="table-primary">
    <td>11</td>
    <td>Peter</td>
  </tr>
  <tr>
    <td>12</td>
    <td>Jane</td>
  </tr>
</table>
Bootstrap table with colored cell
<table class="table">
  <tr>
    <th>ID</th>
	<th>Name</th>
  </tr>
  <tr>
    <td>11</td>
    <td class="table-primary">Peter</td>
  </tr>
  <tr>
    <td>12</td>
    <td>Jane</td>
  </tr>
</table>

Comments

No Comments Yet.
Be the first to tell us what you think.
Bootstrap for beginners
Bootstrap for beginners

Are you learning Bootstrap ? Try our test we designed to help you progress faster.

Test yourself

Chat

Oh, the operator is not available. Leave us your comments. We will answer all your questions as soon as possible.

Comments

Anonymous
Καλησπέρα.
Anonymous
the infinteis -3/15 so 1triition / infinet
Anonymous
e
Anonymous
<a href="https://inspirum.pl "
Anonymous
[url]https://inspirum.pl[/url]
LaceJaguar65
e
LaceJaguar65
e
LaceJaguar65
e
LaceJaguar65
e
LaceJaguar65
e
LaceJaguar65
e
LaceJaguar65
e
LaceJaguar65
e
LaceJaguar65
e
LaceJaguar65
e
LaceJaguar65
e
LaceJaguar65
e
LaceJaguar65
e
LaceJaguar65
e
LaceJaguar65
e
LaceJaguar65
e
LaceJaguar65
e
LaceJaguar65
e
LaceJaguar65
e
LaceJaguar65
e