Time to get a coffee for this bit.
Classes
- nicetable
- responsive-table
- product-table
The nicetable class applies the styling for most tables on the site while responsive-table or product-table makes the table responsive.
Responsive Table
The following is an example of a basic responsive table structure
<table class="nicetable responsive-table">
<thead>
<tr>
<th>Products</th>
<th>Isotype</th>
<th>Reactivity</th>
</tr>
</thead>
<tbody>
<tr>
<td data-name="Products">3-Methylcytosine (3-mC) antibody (pAb)</td>
<td data-name="Isotype">IgG</td>
<td data-name="Reactivity">Human, Mouse, Other (Wide Range)</td>
</tr>
<tr>
<td data-name="Products">3-Methylcytosine (3-mC) antibody (pAb)</td>
<td data-name="Isotype">Serum</td>
<td data-name="Reactivity">Human, Mouse, Other (Wide Range)</td>
</tr>
</tbody>
</table>
Products |
Isotype |
Reactivity |
3-Methylcytosine (3-mC) antibody (pAb) |
IgG |
Human, Mouse, Other (Wide Range) |
3-Methylcytosine (3-mC) antibody (pAb) |
Serum |
Human, Mouse, Other (Wide Range) |
You must wrap the table headers (th and not a td!) and add them to a thead tag.
<thead>
<tr>
<th>Products</th>
<th>Isotype</th>
<th>Reactivity</th>
</tr>
</thead>
All other rows must be added to the tbody tag and require an attribute called data-name. This allows us to style a ::before pseudo-element to contain the text from the attribute that we shows when the screen width changes.
<tbody>
<tr>
<td data-name="Products">3-Methylcytosine (3-mC) antibody (pAb)</td>
<td data-name="Isotype">IgG</td>
<td data-name="Reactivity">Human, Mouse, Other (Wide Range)</td>
</tr>
</tbody>
Product Table
The following is an example of a basic responsive table for products
<table class="nicetable product-table">
<thead>
<tr>
<th>Some Name</th>
<th>Products</th>
<th>Isotype</th>
<th>Reactivity</th>
</tr>
</thead>
<tbody>
<tr>
<td data-name="Name" class="row first">Some Name here</td>
<td data-name="Products" class="row">3-Methylcytosine (3-mC) antibody (pAb)</td>
<td data-name="Isotype" class="row">IgG</td>
<td data-name="Reactivity" class="row">Human, Mouse, Other (Wide Range)</td>
</tr>
<tr>
<td data-name="Name" class="row first" rowspan="2">Some Name here</td>
<td data-name="Products" class="row">3-Methylcytosine (3-mC) antibody (pAb)</td>
<td data-name="Isotype" class="row">IgG</td>
<td data-name="Reactivity" class="row">Human, Mouse, Other (Wide Range)</td>
</tr>
<tr>
<td data-name="Products" class="row">3-Methylcytosine (3-mC) antibody (pAb)</td>
<td data-name="Isotype" class="row">IgG</td>
<td data-name="Reactivity" class="row">Human, Mouse, Other (Wide Range)</td>
</tr>
</tbody>
</table>
Some Name |
Products |
Isotype |
Reactivity |
Some Name here |
3-Methylcytosine (3-mC) antibody (pAb) |
IgG |
Human, Mouse, Other (Wide Range) |
Some Name here |
3-Methylcytosine (3-mC) antibody (pAb) |
Serum |
Human, Mouse, Other (Wide Range) |
3-Methylcytosine (3-mC) antibody (pAb) |
Serum |
Human, Mouse, Other (Wide Range) |
As before you must wrap the table headers (th and not a td!) and add them to a thead tag.
The difference to this table type is the tbody rows require the class row and the first td tag requires the class first, see below:
<tbody>
<tr>
<td data-name="Name" class="row first">Some Name here</td>
<td data-name="Products" class="row">3-Methylcytosine (3-mC) antibody (pAb)</td>
<td data-name="Isotype" class="row">IgG</td>
<td data-name="Reactivity" class="row">Human, Mouse, Other (Wide Range)</td>
</tr>
</tbody>
For rows which have 1 Name and many rows associated with it for purchase you must do the following.
Also, notice how the first row has the first class with a rowspan of 2 and then the 1st td of the 2nd tr doesn't have the first class or a rowspan.
<tbody>
<tr>
<td data-name="Name" class="row first" rowspan="2">Some Name here</td>
<td data-name="Products" class="row">3-Methylcytosine (3-mC) antibody (pAb)</td>
<td data-name="Isotype" class="row">IgG</td>
<td data-name="Reactivity" class="row">Human, Mouse, Other (Wide Range)</td>
</tr>
<tr>
<td data-name="Products" class="row">3-Methylcytosine (3-mC) antibody (pAb)</td>
<td data-name="Isotype" class="row">IgG</td>
<td data-name="Reactivity" class="row">Human, Mouse, Other (Wide Range)</td>
</tr>
</tbody>
If there are 3 or more rows to do with 1 product then you would change the rowspan accordingly. Here are 4 rows and 3 of them are associated with the 1st. So a rowspan of 4.
<tbody>
<tr>
<td data-name="Name" class="row first" rowspan="4">Some Name here</td>
<td data-name="Products" class="row">3-Methylcytosine (3-mC) antibody (pAb)</td>
<td data-name="Isotype" class="row">IgG</td>
<td data-name="Reactivity" class="row">Human, Mouse, Other (Wide Range)</td>
</tr>
<tr>
<td data-name="Products" class="row">3-Methylcytosine (3-mC) antibody (pAb)</td>
<td data-name="Isotype" class="row">IgG</td>
<td data-name="Reactivity" class="row">Human, Mouse, Other (Wide Range)</td>
</tr>
<tr>
<td data-name="Products" class="row">3-Methylcytosine (3-mC) antibody (pAb)</td>
<td data-name="Isotype" class="row">IgG</td>
<td data-name="Reactivity" class="row">Human, Mouse, Other (Wide Range)</td>
</tr>
<tr>
<td data-name="Products" class="row">3-Methylcytosine (3-mC) antibody (pAb)</td>
<td data-name="Isotype" class="row">IgG</td>
<td data-name="Reactivity" class="row">Human, Mouse, Other (Wide Range)</td>
</tr>
</tbody>
Some Name |
Products |
Isotype |
Reactivity |
Some Name here |
3-Methylcytosine (3-mC) antibody (pAb) |
Serum |
Human, Mouse, Other (Wide Range) |
3-Methylcytosine (3-mC) antibody (pAb) |
Serum |
Human, Mouse, Other (Wide Range) |
3-Methylcytosine (3-mC) antibody (pAb) |
Serum |
Human, Mouse, Other (Wide Range) |
3-Methylcytosine (3-mC) antibody (pAb) |
Serum |
Human, Mouse, Other (Wide Range) |
The big one is if you want a purchase option in there too. So here are some examples:
<table class="nicetable product-table">
<thead>
<tr>
<th>Some Name</th>
<th>Products</th>
<th>Isotype</th>
<th>Reactivity</th>
<th> </th>
</tr>
</thead>
<tbody>
<tr>
<td data-name="Name" class="row first" rowspan="2">Some Name here</td>
<td data-name="Products" class="row">3-Methylcytosine (3-mC) antibody (pAb)</td>
<td data-name="Isotype" class="row">IgG</td>
<td data-name="Reactivity" class="row">Human, Mouse, Other (Wide Range)</td>
<td class="col-action"><a href="#" class="buy-btn">Buy</a></td>
</tr>
<tr>
<td data-name="Products" class="row">3-Methylcytosine (3-mC) antibody (pAb)</td>
<td data-name="Isotype" class="row">IgG</td>
<td data-name="Reactivity" class="row">Human, Mouse, Other (Wide Range)</td>
<td class="col-action not_applicable">N/A</td>
</tr>
</tbody>
</table>
Some Name |
Products |
Isotype |
Reactivity |
|
Some Name here |
3-Methylcytosine (3-mC) antibody (pAb) |
Serum |
Human, Mouse, Other (Wide Range) |
Buy |
3-Methylcytosine (3-mC) antibody (pAb) |
Serum |
Human, Mouse, Other (Wide Range) |
N/A |
Notice how there is a buy button and a Not Applicable state, both of these require classes on the td of a base col-action