I want to make my border-top full table width but it's only taking my table data (td) size...
The last tr have my border-top but it's not taking the full size of the table.
th {
border: 0 solid #581D74;
border-bottom-width: 1px;
padding: 15px;
}
tr, td, th {
text-align: left;
padding: 15px;
}
.add-btn {
min-width: 0;
color: white;
}
.add-icon {
color: #581d74;
}
.total-row {
border: 0 solid #581d74;
border-top-width: 1px;
padding: 15px;
border-collapse: collapse;
}
<table class="disinves-table">
<tr class="table-header">
<th></th>
<th>head 1</th>
<th>head 2</th>
<th>head3</th>
</tr>
<tr>
<td><button mat-button class="add-btn"><mat-icon class="add-icon">add_circle</mat-icon></button></td>
<td>first data</td>
<td>19%</td>
</tr>
<tr class="total-row">
<td>Total</td>
<td></td>
<td>8654</td>
</tr>
</table>
If you are complaining about the gaps you see in the border, that is because the default style of a table is to have a few pixels of space between the cells.
Solution: set the table's border-spacing to 0.
.disinves-table {
border-spacing: 0;
}
th {
border: 0 solid #581D74;
border-bottom-width: 1px;
padding: 15px;
}
tr, td, th {
text-align: left;
padding: 15px;
}
.add-btn {
min-width: 0;
color: white;
}
.add-icon {
color: #581d74;
}
.total-row {
border: 0 solid #581d74;
border-top-width: 1px;
padding: 15px;
border-collapse: collapse;
}
<table class="disinves-table">
<tr class="table-header">
<th></th>
<th>head 1</th>
<th>head 2</th>
<th>head3</th>
</tr>
<tr>
<td><button mat-button class="add-btn"><mat-icon class="add-icon">add_circle</mat-icon></button></td>
<td>first data</td>
<td>19%</td>
</tr>
<tr class="total-row">
<td>Total</td>
<td></td>
<td>8654</td>
</tr>
</table>
Related
I have a table that uses rowspan for one of the table headers. This table also switches to a fixed column style on smaller sizes. The issue I'm running into is on smaller sizes, when the th with the rowspan becomes fixed, it messes up the structure of the remaning th.
A solution I thought of was to just have an empty th above Foods so I didn't have to use a rowspan, but due to ADA requirments, that's not an option.
Here's some code: CODEPEN
This is the large screen view - you can see there's a Foods column as well as two groups, each of which containing two columns.
Here's a view of when it goes to the fixed column layout. You can see that Group 1 - Col 1 now takes the place where Foods used to be, and the entire 2nd shifted.
HTML:
<div class="wrap">
<table>
<thead>
<tr>
<th rowspan="2" class="fixed">Foods</th>
<th colspan="2">Group 1</th>
<th colspan="2">Group 2</th>
</tr>
<tr>
<th>Col 1</th>
<th>Col 2</th>
<th>Col 3</th>
<th>Col 4</th>
</tr>
</thead>
<tbody>
<tr>
<td class="fixed">Tacos</td>
<td>blank</td>
<td>blank</td>
<td>blank</td>
<td>blank</td>
</tr>
<tr>
<td class="fixed">Pizza</td>
<td>blank</td>
<td>blank</td>
<td>blank</td>
<td>blank</td>
</tr>
</tbody>
</table>
</div>
CSS:
table {
border: solid 1px black;
border-spacing: 0;
border-collapse: collapse;
width: 900px;
}
th {
vertical-align: bottom;
padding: 5px 10px;
border-left: solid 1px grey;
}
th[colspan="2"] {
border-bottom: solid 1px grey;
}
td {
border-top: solid 1px grey;
}
tbody tr:nth-child(odd) td {
background: grey;
}
.fixed {
border-left: none;
}
#media (max-width: 600px) {
.fixed {
position: absolute;
width: 50px;
left: 0;
}
.wrap {
overflow-x: scroll;
overflow-y: visible;
margin-left: 50px;
}
}
I am not really sure about the issue but it seems to be related to the use of position:fixed. You are removing the elements from the flow so it's like they no more belong to the table making the table algorithm behave strange.
An idea of fix is to consider a extra element that you make visible on small screen to avoid this issue. Basically this element will correct the table layout when you make some of the element position:fixed
* {
text-align: center;
font-weight: normal;
}
table {
border: solid 1px black;
border-spacing: 0;
border-collapse: collapse;
width: 900px;
}
th {
vertical-align: bottom;
padding: 5px 10px;
border-left: solid 1px grey;
}
th[colspan="2"] {
border-bottom: solid 1px grey;
}
td {
border-top: solid 1px grey;
}
tbody tr:nth-child(odd) td {
background: grey;
}
.fixed {
border-left: none;
}
.fix {
padding:0;
border:none;
}
#media (min-width:700px) {
.fix {
display:none;
}
}
#media (max-width: 700px) {
.fixed {
position: absolute;
width: 50px;
left: 0;
}
.wrap {
overflow-x: scroll;
overflow-y: visible;
margin-left: 50px;
}
}
<div class="wrap">
<table>
<thead>
<tr>
<th rowspan="2" class="fixed">Foods</th>
<th colspan="2">Group 1</th>
<th colspan="2">Group 2</th>
</tr>
<tr>
<th class="fix"></th>
<th>Col 1</th>
<th>Col 2</th>
<th>Col 3</th>
<th>Col 4</th>
</tr>
</thead>
<tbody>
<tr>
<td class="fixed">Tacos</td>
<td>blank</td>
<td>blank</td>
<td>blank</td>
<td>blank</td>
</tr>
<tr>
<td class="fixed">Pizza</td>
<td>blank</td>
<td>blank</td>
<td>blank</td>
<td>blank</td>
</tr>
</tbody>
</table>
</div>
To avoid extra element you can consider pseudo element:
* {
text-align: center;
font-weight: normal;
}
table {
border: solid 1px black;
border-spacing: 0;
border-collapse: collapse;
width: 900px;
}
th {
vertical-align: bottom;
padding: 5px 10px;
border-left: solid 1px grey;
}
th[colspan="2"] {
border-bottom: solid 1px grey;
}
td {
border-top: solid 1px grey;
}
tbody tr:nth-child(odd) td {
background: grey;
}
.fixed {
border-left: none;
}
thead > tr:last-child::before {
content:"";
display:table-cell;
padding:0;
border:none;
}
#media (min-width:700px) {
thead > tr:last-child::before {
display:none;
}
}
#media (max-width: 700px) {
.fixed {
position: absolute;
width: 50px;
left: 0;
}
.wrap {
overflow-x: scroll;
overflow-y: visible;
margin-left: 50px;
}
}
<div class="wrap">
<table>
<thead>
<tr>
<th rowspan="2" class="fixed">Foods</th>
<th colspan="2">Group 1</th>
<th colspan="2">Group 2</th>
</tr>
<tr>
<th>Col 1</th>
<th>Col 2</th>
<th>Col 3</th>
<th>Col 4</th>
</tr>
</thead>
<tbody>
<tr>
<td class="fixed">Tacos</td>
<td>blank</td>
<td>blank</td>
<td>blank</td>
<td>blank</td>
</tr>
<tr>
<td class="fixed">Pizza</td>
<td>blank</td>
<td>blank</td>
<td>blank</td>
<td>blank</td>
</tr>
</tbody>
</table>
</div>
I want add space between row on table like image below:
If possible please show your code to me.
The border-spacing property will work for this particular case.
table {
border-collapse:separate;
border-spacing: 0 1em;
}
https://developer.mozilla.org/en-US/docs/Web/CSS/border-spacing
Or you can use the hacky approach. That give the appearance of margins between table rows i
tr{
border: 5px solid white;
}
You can use border-spacing. Here is an simple example.
table, th, td {
background: #ffffff;
padding: 5px;
}
table {
background: #999999;
border-spacing: 15px;
}
<h2>Border Spacing</h2>
<p>Border spacing specifies the space between the cells.</p>
<table style="width:100%">
<tr>
<th>Firstname</th>
<th>Lastname</th>
<th>Age</th>
</tr>
<tr>
<td>Jill</td>
<td>Smith</td>
<td>50</td>
</tr>
<tr>
<td>Eve</td>
<td>Jackson</td>
<td>94</td>
</tr>
<tr>
<td>John</td>
<td>Doe</td>
<td>80</td>
</tr>
</table>
<p>Try to change the border-spacing to 5px.</p>
https://www.w3schools.com/html/html_tables.asp
https://www.w3schools.com/html/tryit.asp?filename=tryhtml_table_cellspacing
The border-spacing property sets the distance between the borders of adjacent cells.
Note: This property works only when border-collapse is separate.
table {
border-collapse: separate;
border-spacing: 15px;
}
You cannot give margin to the table row. you can either give border-colapse and border spacing to the table or give border to table row and change its color to table background color. Plz refer below link.
Thanks
http://jsfiddle.net/x1hphsvb/10966/
table{
border-collapse: separate;
border-spacing: 0 20px;
background-color: #e3e7ee
}
table tr td{
padding:20px !important;
background-color:white;
}
/* this is the second option */
tr{
/* border:2px solid #e3e7ee !important */
}
<table class="table ">
<thead>
<tr>
<th>Firstname</th>
<th>Lastname</th>
<th>Email</th>
</tr>
</thead>
<tbody>
<tr>
<td>John</td>
<td>Doe</td>
<td>john#example.com</td>
</tr>
<tr>
<td>Mary</td>
<td>Moe</td>
<td>mary#example.com</td>
</tr>
<tr>
<td>July</td>
<td>Dooley</td>
<td>july#example.com</td>
</tr>
</tbody>
</table>
Try to use this for the design
or visit for more code demo
#import "https://stackpath.bootstrapcdn.com/bootstrap/4.3.1/css/bootstrap.min.css";
.caseTableWrap {
margin-bottom: 50px;
background: #f5f5f5;
padding: 20px; }
.caseTable {
border-collapse: separate;
border-spacing: 0 20px; }
.caseTable tr {
-webkit-box-shadow: 0px 10px 10px rgba(0, 0, 0, 0.05);
box-shadow: 0px 10px 10px rgba(0, 0, 0, 0.05);
-webkit-transition: all 0.5s;
-o-transition: all 0.5s;
transition: all 0.5s; }
.caseTable tr + tr {
cursor: pointer; }
.caseTable tr + tr:hover {
-webkit-transform: translateY(-2px);
-ms-transform: translateY(-2px);
transform: translateY(-2px);
-webkit-box-shadow: 0px 10px 10px rgba(0, 0, 0, 0.2);
box-shadow: 0px 10px 10px rgba(0, 0, 0, 0.2); }
.caseTable tr .caseTableData:last-child, .caseTable tr th:last-child, .caseTable tr td:last-child {
max-width: 220px; }
.caseTable tr th {
border: none;
font-size: 18px;
font-weight: 500; }
.caseTable tr th:first-child {
border-radius: 8px 0 0 8px; }
.caseTable tr th:last-child {
border-radius: 0 8px 8px 0; }
.caseTable tr td {
border: none;
position: relative; }
.caseTable tr td:first-child {
border-radius: 8px 0 0 8px; }
.caseTable tr td:last-child {
border-radius: 0 8px 8px 0; }
.caseTable tr .caseTableData, .caseTable tr th, .caseTable tr td {
background: #fff;
padding: 20px;
position: relative; }
.caseTable tr .caseTableData p, .caseTable tr th p, .caseTable tr td p {
color: #484848;
font-size: 16px;
font-weight: 400; }
<div class="caseTableWrap">
<div class="container-fluid">
<div class="row">
<div class="col-12">
<div class="caseTableInner">
<h3 class="secTitle">
<div class="text">
Recent Case
</div>
</h3>
<div class="caseTableWrap table-responsive">
<table class="table caseTable">
<tr>
<th>Case ID</th>
<th>Created Date</th>
<th>Expiry Date</th>
<th>Status</th>
</tr>
<tr>
<td>75814</td>
<td>01 January 2020</td>
<td>30 January 2020</td>
<td>Delivered</td>
</tr>
<tr>
<td>75814</td>
<td>01 January 2020</td>
<td>30 January 2020</td>
<td>Delivered</td>
</tr>
<tr>
<td>75814</td>
<td>01 January 2020</td>
<td>30 January 2020</td>
<td>Delivered</td>
</tr>
<tr>
<td>75814</td>
<td>01 January 2020</td>
<td>30 January 2020</td>
<td>Delivered</td>
</tr>
<tr>
<td>75814</td>
<td>01 January 2020</td>
<td>30 January 2020</td>
<td>Delivered</td>
</tr>
</table>
</div>
</div>
</div>
</div>
</div>
</div>
Best option:
*{box-sizing: border-box}
table {
border-collapse: separate;
}
tr > td {
display: inline-block;
margin-top: 1rem;
border-right: 1px solid black;
border-bottom: 1px solid black;
border-top: 1px solid black;
}
tr > td:first-of-type {
border-left: 1px solid black;
}
you can add top and bottom borders with the same color as the background
table{
width: 100%;
border-collapse: collapse;
}
tr{border-bottom: 4px solid white;border-radius: 10px;}
th{ background-color: white;}
td{ background-color: grey;}
<table>
<thead>
<tr>
<th>Name</th>
<th>id</th>
</tr>
</thead>
<tbody>
<tr>
<td>BDR</td>
<td>1</td>
</tr>
<tr>
<td>Bader</td>
<td>2</td>
</tr>
</tbody>
</table>
I was wondering how could I create a custom looking Table like that?
body {
background-color: white;
}
table {
border: 1px solid black;
border-radius: 15px;
background: lightgrey;
color: black;
padding-left: 15px;
padding-right: 15px;
}
.t_head {
background-color: dodgerblue;
}
td {
padding-left: 10px;
padding-right: 10px;
}
#t_body {
background-color: grey;
}
<div id="test_div">
<table>
<thead>
<tr>
<div class="t_head">
<th>Test Header</th>
<th>Test Header</th>
<th>Test Header</th>
</div>
</tr>
</thead>
<tbody>
<div id="t_body">
<tr>
<th>Test data</th>
<th>Test data</th>
<th>Test data</th>
</tr>
<tr>
<th>Test data</th>
<th>Test data</th>
<th>Test data</th>
</tr>
</div>
</tbody>
</table>
</div>
I tried to add some styling for thead/tr element but the results are pretty much the same. Also, the borders in thead is something I can't add. I am very new to html and css and my searching attempts weren't very successful. I would appreciate any help!
Firstly, fix your html - remove the divs from the table as they are invalid, then you can put the blue colour on the cells in the header and the grey on the cells in the body.
I have put a whole border on the table and hidden the overflow for the rounded edges, then on the header I have just added a bottom and left border to fill in the lines - removing the left from the first cell (as that is on the outline of the whole table).
The border-spacing just removes any space between the cells so the borders are next to each other (like using border-collapse)
body {
background-color: white;
}
table {
overflow: hidden;
color: black;
border: 1px solid #000000;
border-radius: 15px;
border-spacing: 0;
}
thead th {
border-bottom: 1px solid black;
border-left: 1px solid black;
padding: 5px 10px;
background-color: dodgerblue;
border-collapse: collapse;
}
thead th:first-child {
border-left: none;
}
td {
padding: 5px 10px;
background: lightgrey;
}
<div id="test_div">
<table>
<thead>
<tr>
<th>Test Header</th>
<th>Test Header</th>
<th>Test Header</th>
</tr>
</thead>
<tbody>
<tr>
<td>Test data</td>
<td>Test data</td>
<td>Test data</td>
</tr>
<tr>
<td>Test data</td>
<td>Test data</td>
<td>Test data</td>
</tr>
</tbody>
</table>
</div>
You could do this with divs and flex, it's easier
https://codepen.io/anon/pen/YJyBmy
.d-flex {
display: flex;
}
#table {
border: 4px solid black;
border-radius: 20px;
width: 500px;
}
#thead>div,
#tbody>div {
border-left: 4px solid black;
padding: 15px;
width: 33%;
}
#thead>div:first-child,
#tbody>div:first-child {
border: 0;
}
#thead {
background: dodgerblue;
border-radius: 15px 15px 0 0;
border-bottom: 4px solid black;
}
#tbody {
background: grey;
border-radius: 0 0 15px 15px;
}
<div id="table">
<div id="thead" class="d-flex">
<div>test</div>
<div>test</div>
<div>test</div>
</div>
<div id="tbody" class="d-flex">
<div>test</div>
</div>
</div>
I have an simple html table where I want to only display the borders between columns and hide the borders between rows. I tried the code below but it did not achieve what I was after.
I have also used border-collapse : collapse in css, but it didn't seem to work.
table td, table th { border: 1px solid black; padding: 5px; }
#items { clear: both; margin: 30px 0 0 0; border: 1px solid black; }
#items th { background: #eee; }
#items textarea { width: 300px; height: 50px; }
#items,td {
border-collapse: collapse;
border-spacing: 0;
margin: 0;
padding: 0;
}
<table id="items">
<thead>
<tr>
<th style="width:100px;">Slno</th>
<th style="width:300px;">Description of Goods</th>
<th style="width:120px;">Quantity</th>
</tr>
</thead>
<tbody class="tbody">
<tr>
<td>1</td>
<td>S1</td>
<td>3</td>
</tr>
<tr>
<td>2</td>
<td>S2</td>
<td>5</td>
</tr>
<tr>
<td>3</td>
<td>S3</td>
<td>5</td>
</tr>
</tbody>
</table>
Is this what you looking for
table th { border: 1px solid black; padding: 5px; }
table td{ padding: 5px; }
#items { clear: both; margin: 30px 0 0 0; border: 1px solid black; }
#items th { background: #eee; }
#items textarea { width: 300px; height: 50px; }
#items,td {
border-collapse: collapse;
border-spacing: 0;
margin: 0;
padding: 0;
}
<table id="items">
<thead>
<tr>
<th style="width:100px;">Slno</th>
<th style="width:300px;">Description of Goods</th>
<th style="width:120px;">Quantity</th>
</tr>
</thead>
<tbody class="tbody">
<tr>
<td>1</td>
<td>S1</td>
<td>3</td>
</tr>
<tr>
<td>2</td>
<td>S2</td>
<td>5</td>
</tr>
<tr>
<td>3</td>
<td>S3</td>
<td>5</td>
</tr>
</tbody>
</table>
you made the th/td to have "border:1px solid black" but you only need border-right
table td, table th {border-right: 1px solid black; padding: 5px; }
#items { clear: both; margin: 30px 0 0 0; }
#items th { background: #eee; }
#items textarea { width: 300px; height: 50px; }
#items,td {
border-collapse: collapse;
border-spacing: 0;
margin: 0;
padding: 0;
}
<table id="items">
<thead>
<tr>
<th style="width:100px;">Slno</th>
<th style="width:300px;">Description of Goods</th>
<th style="width:120px;">Quantity</th>
</tr>
</thead>
<tbody class="tbody">
<tr>
<td>1</td>
<td>S1</td>
<td>3</td>
</tr>
<tr>
<td>2</td>
<td>S2</td>
<td>5</td>
</tr>
<tr>
<td>3</td>
<td>S3</td>
<td>5</td>
</tr>
</tbody>
</table>
Add border right only
table td, table th { border-right: 1px solid black; padding: 5px; }
#items { clear: both; margin: 30px 0 0 0; border: 1px solid black; }
#items th { background: #eee; }
#items textarea { width: 300px; height: 50px; }
#items,td {
border-collapse: collapse;
border-spacing: 0;
margin: 0;
padding: 0;
}
<table id="items">
<thead>
<tr>
<th style="width:100px;">Slno</th>
<th style="width:300px;">Description of Goods</th>
<th style="width:120px;">Quantity</th>
</tr>
</thead>
<tbody class="tbody">
<tr>
<td>1</td>
<td>S1</td>
<td>3</td>
</tr>
<tr>
<td>2</td>
<td>S2</td>
<td>5</td>
</tr>
<tr>
<td>3</td>
<td>S3</td>
<td>5</td>
</tr>
</tbody>
</table>
I'm trying to style table with what I thought would be a fairly simple style to achieve but have run in to a little issue.
The table will show a coloured indicator on the left hand side of each row so I'm using border-left: 5px solid red; to add it. However, although the border applies - half of it is inside the row and half outside. I've tried adding border-collapse: collapse to no avail, I'm also using box-sizing: border-box but still have the same issue.
Finally, I've also tried adding the border to the first-child cell (td) but the same issue appears.
I've set up an example of what's happening - I've put in an oversized border to highlight the issue:
http://www.cssdesk.com/TVa67
Has anyone run into this before or have any solutions?
body {
background: blue;
}
table {
border-collapse: collapse;
box-sizing: border-box;
table-layout: fixed;
width: 100%;
}
th,
td {
background-color: #fff;
padding: 10px 15px 8px;
}
th {
border-bottom: 1px solid blue;
font-weight: normal;
text-align: left;
}
td {
border-bottom: 1px solid gray;
}
tr.low {
border-left: 25px solid red;
}
<table style="
border-collapse: collapse;
">
<tbody>
<tr>
<th>#</th>
<th>Status</th>
<th>Title</th>
<th>Project</th>
<th>Assigned To</th>
<th>Age</th>
</tr>
<tr class="low">
<td>1</td>
<td>New</td>
<td>This is an example ticket</td>
<td>Something</td>
<td>Something</td>
<td>2 days ago</td>
</tr>
</tbody>
</table>
However, although the border applies - half of it is inside the row
and half outside
This behaviour is expected and is as per specs. Refer to: http://www.w3.org/TR/CSS2/tables.html#collapsing-borders where it says:
Borders are centered on the grid lines between the cells...
It also illustrates that with a diagram with description.
Has anyone run into this before or have any solutions?
Yes, it can be easily demonstrated as in this fiddle: http://jsfiddle.net/abhitalks/xs7L9wn1/1/ and the below Snippet:
* { box-sizing: border-box; }
table {
border-collapse: collapse;
border: 1px solid gray;
table-layout: fixed; width: 70%;
margin: 0 auto;
}
th, td {
border: 1px solid gray;
padding: 6px;
text-align: center;
}
tbody > tr:nth-child(1) > td:first-child { border-left: 16px solid red; }
tbody > tr:nth-child(2) > td:first-child { border-left: 8px solid green; }
tbody > tr:nth-child(3) > td:first-child { border-left: 24px solid blue; }
tbody > tr:nth-child(1) > td:last-child { border-left: 16px solid red; }
tbody > tr:nth-child(2) > td:last-child { border-left: 8px solid green; }
tbody > tr:nth-child(3) > td:last-child { border-left: 24px solid blue; }
<table>
<thead>
<tr>
<th>#</th>
<th>Header 1</th>
<th>Header 2</th>
</tr>
</thead>
<tbody>
<tr>
<td>1</td>
<td>Caption</td>
<td>Description</td>
</tr>
<tr>
<td>2</td>
<td>Caption</td>
<td>Description</td>
</tr>
<tr>
<td>3</td>
<td>Caption</td>
<td>Description</td>
</tr>
</tbody>
</table>
Solution:
Just add a transparent border of the same width to all rows. That way the border-width will be same and it will neatly align. (Update: added a white border-left to first column to hide the hanging border on highlighted cell. As pointed out by your comment.)
th, td { border-left: 15px solid transparent; }
tr > td:first-child, tr > th:first-child { border-left: 5px solid #fff; }
tr.low > td:first-child { border-left: 5px solid red; }
Example Fiddle: https://jsfiddle.net/abhitalks/s9taanz7/5/
Snippet:
* { box-sizing: border-box; }
body { background-color: blue; }
table {
border-collapse: collapse;
table-layout: fixed; width: 100%;
}
th, td {
background-color: #fff;
padding: 10px 15px 8px 8px;
border-left: 5px solid transparent;
border-bottom: 1px solid gray;
}
th {
border-bottom: 1px solid blue;
font-weight: normal; text-align: left;
}
tr > td:first-child, tr > th:first-child { border-left: 10px solid #fff; }
tr.low > td:first-child { border-left: 10px solid red; }
<table>
<thead>
<tr>
<th>#</th>
<th>Status</th>
<th>Title</th>
<th>Project</th>
<th>Assigned To</th>
<th>Age</th>
</tr>
</thead>
<tbody>
<tr class="">
<td>1</td>
<td>New</td>
<td>This is an example ticket</td>
<td>Something</td>
<td>Something</td>
<td>2 days ago</td>
</tr>
<tr class="low">
<td>2</td>
<td>New</td>
<td>This is an example ticket</td>
<td>Something</td>
<td>Something</td>
<td>2 days ago</td>
</tr>
<tr class="">
<td>3</td>
<td>New</td>
<td>This is an example ticket</td>
<td>Something</td>
<td>Something</td>
<td>2 days ago</td>
</tr>
</tbody>
</table>
However, this approach will have a side-effect of hidden border-bottom because the border-left overlaps it.
Solution 2:
You could have an extra cell on the left to use as indicator. You can then control this by use of colgroup. This approach is neater than above and also requires you to have the width specified only once in css.
Example Fiddle 2: http://jsfiddle.net/abhitalks/z7u1nhwt/1/
Snippet 2:
* { box-sizing: border-box; }
body { background-color: blue; }
table {
border-collapse: collapse;
table-layout: fixed; width: 100%;
}
th, td {
background-color: #fff;
padding: 10px 15px 8px 8px;
border-bottom: 1px solid gray;
}
th {
border-bottom: 1px solid blue;
font-weight: normal; text-align: left;
}
.col1 { width: 10px; }
tr.low > td:first-child {
background-color: #f00;
}
<table>
<colgroup>
<col class="col1" />
<col class="coln" span="6" />
</colgroup>
<thead>
<tr>
<th></th>
<th>#</th>
<th>Status</th>
<th>Title</th>
<th>Project</th>
<th>Assigned To</th>
<th>Age</th>
</tr>
</thead>
<tbody>
<tr class="">
<td></td>
<td>1</td>
<td>New</td>
<td>This is an example ticket</td>
<td>Something</td>
<td>Something</td>
<td>2 days ago</td>
</tr>
<tr class="low">
<td></td>
<td>2</td>
<td>New</td>
<td>This is an example ticket</td>
<td>Something</td>
<td>Something</td>
<td>2 days ago</td>
</tr>
<tr class="">
<td></td>
<td>3</td>
<td>New</td>
<td>This is an example ticket</td>
<td>Something</td>
<td>Something</td>
<td>2 days ago</td>
</tr>
</tbody>
</table>
And of course, you can also try the approach of using pseudo-element as proposed by #misterManSam, depending on ease of implementation for you.