I want to create a responsive table only with HTML & CSS that has a icon button aligned to right side when on responsive view as similar to the bellow image. The bellow code renders a responsive table, however the icon is also aligned on the next line. I want it to be aligned on right side as in image. any one Please help on this.
table {
border: 1px solid #ccc;
border-radius: 5px;
/* border-collapse: collapse; */
margin: 0;
padding: 0;
width: 50%;
table-layout: fixed;
}
table tr {
background-color: white;
border: 1px solid #ddd;
padding: 10px;
}
table th,
table td {
padding: 10px;
text-align: left;
border-bottom: 1px solid #ddd;
}
table th {
font-size: 15px;
text-transform: uppercase;
}
#media screen and (max-width: 600px) {
table {
border: 0;
width: 100%
}
table thead {
border: none;
/* clip: rect(0 0 0 0); */
height: 1px;
margin: -1px;
overflow: hidden;
padding: 0;
position: absolute;
width: 1px;
}
table tr {
border-bottom: 1px solid #ddd;
display: block;
/* margin-bottom: .625em; */
}
table td {
border-bottom: 1px solid #ddd;
display: block;
font-size: 13px;
text-align: right;
}
table td::before {
content: attr(data-label);
float: left;
font-weight: bold;
text-transform: uppercase;
}
table td:last-child {
border-bottom: 0;
}
}
<table>
<thead>
<tr>
<th scope="col">Name</th>
<th scope="col">Type</th>
<th scope="col">Upload Date</th>
<th scope="col"></th>
</tr>
</thead>
<tbody>
<tr>
<td data-label="Name">John</td>
<td data-label="Type">file</td>
<td data-label="Upload Date">21/04/20</td>
<td class="dropdown">
<p><a id="" class="ti-more-alt"></a></p>
<div class="dropdown-content">
View
</div>
</td>
</tr>
<tr>
<td data-label="Name">John</td>
<td data-label="Type">file</td>
<td data-label="Upload Date">21/04/20</td>
<td class="dropdown">
<p><a id="" class="ti-more-alt"></a></p>
<div class="dropdown-content">
View
</div>
</td>
</tr>
<tr>
<td data-label="Name">John</td>
<td data-label="Type">file</td>
<td data-label="Upload Date">21/04/20</td>
<td class="dropdown">
<p><a id="" class="ti-more-alt"></a></p>
<div class="dropdown-content">
View
</div>
</td>
</tr>
</tbody>
</table>
Related
The below picture represents a timeline. Here the task "Exercise" starts from 8:00 to 8:15 and which has been marked with light-blue background color. The other two tasks - first one is "Travel to work" and second one is "Plan day" - are getting overlapped because the former task ("Travel to work") starts from 8:25 to 8:55 and the later task ("Plan day") starts from 8:30 to 9:00. So the overlapping tasks should show as given in the picture.
I tried to implement this using HTML table and css but I am really stuck to move further and its not working the way it is showing in the picture.
<style>
.line{
/* width: 100%; */
border-top: 1px solid black;
/* position: absolute; */
background-color: #ADD8E6;
width: 45%;
height: 30pt;
}
.halfAnHour{
font-size: 11px;
/* text-align: right; */
}
.title{
font-size: 10px;
}
.starttime{
text-align: right;
vertical-align: top;
white-space: nowrap;
}
.time{
border-top: 1px solid black;
width: 10%;
height: 30pt;
}
</style>
<body>
<table style="width: 100%;">
<tr>
<td class="time" style="width: 10%;height: 30pt;">8:00</td>
<td class="line" style="width: 45%;height: 30pt;">Excercise</td>
<td class="line" style="width: 45%;height: 30pt;"> </td>
</tr>
<tr>
<td class="time" style="height: 30pt;">8:30</td>
<td class="line">Travel to work</td>
<td class="line"> </td>
</tr>
<tr>
<td class="time">9:00</td>
<td class="line">Plan day</td>
<td class="line"> </td>
</tr>
<tr>
<td class="time">9:30</td>
<td class="line">Review yesterday's comments</td>
<td class="line"> </td>
</tr>
</table>
</body>
You could use CSS Flexbox and some manipulation of position to overlap tasks occurring in the same hour. This is a good start to achieving a similar layout to the image you provided.
.line{
/* width: 100%; */
border-top: 1px solid black;
/* position: absolute; */
background-color: #ADD8E6;
width: 100%;
height: 30pt;
}
.title{
font-size: 10px;
}
.time{
border-top: 1px solid black;
width: 49px;
width: auto;
height: 30pt;
color: #555;
}
table tr {
display: flex;
align-items: center;
}
table tr td {
flex: initial;
}
table tr td:not(:first-child) {
border-left: .19rem solid blue;
}
table .overlap {
margin-top: .75rem;
}
table .overlap td {
height: 3rem;
margin-bottom: -7px;
}
table .overlap > .time {
padding-right: .6rem;
}
table .overlap .line:last-child {
position: relative;
left: -.5px;
bottom: -2px;
}
.hour {
font-size: 1.3rem;
}
<body>
<table style="width: 100%;">
<tr>
<td class="time hour">8:00</td>
<td class="line">Excercise</td>
</tr>
<tr class="overlap">
<td class="time half">8:30</td>
<td class="line">Plan day</td>
<td class="line" style="margin-bottom: .5rem">Travel to work</td>
</tr>
<tr>
<td class="time hour">9:00</td>
<td class="line">Review yesterday's comments</td>
</tr>
</table>
</body>
I'm stuck with a simple table design as i'm from backend I need a table like this
What I have right now
table {
border-collapse: collapse;
width: 100%;
}
tr {
border: none;
}
.first{
width: 40%;
font-family: Quasimoda;
font-size: 0.75em;
color: #1D1D1E;
}
.middle{
width: 60%;
font-family: Quasimoda;
font-size: 0.75em;
color: #1D1D1E;
}
.last{
width: 40%;
font-family: Quasimoda;
font-size: 0.75em;
color: #1D1D1E;
}
td {
border-bottom: 1px solid #ddd;
border-top: 1px solid #ddd;
padding: 10px;
}
<table>
<tr>
<td class="University">January</td>
<td class="middle ">the progress bar will be placed here </td>
<td class="last">870</td>
</tr>
<tr>
<td class="first">January</td>
<td class="middle ">the progress bar will be placed here </td>
<td class="last">560</td>
</tr>
</table>
Please help. I have tried with multiple html table attributes all gone in vain.
Set the thead tr element bottom border, and the right border of the .first element:
table {
border-collapse: collapse;
width: 100%;
}
th {
text-align: left;
border-bottom: 1px solid #ddd;
}
td {
padding: 10px;
font-family: Quasimoda;
font-size: 0.75em;
color: #1D1D1E;
}
.first {
border-right: 1px solid #ddd;
}
.middle {
width: 100%;
}
<table>
<thead>
<tr>
<th colspan="3">Unique values:</th>
</tr>
</thead>
<tbody>
<tr>
<td class="first">January</td>
<td class="middle ">the progress bar will be placed here </td>
<td class="last">870</td>
</tr>
<tr>
<td class="first">January</td>
<td class="middle ">the progress bar will be placed here </td>
<td class="last">560</td>
</tr>
</tbody>
</table>
Actually, your picture is not that clear.
I was not clear where you want border actually.
But I try to do this, Run the code snippet and have a look, and let me know if this works for you or not.
.colspan2border
{
border-collapse: collapse;
border-bottom: 1px solid red;
}
.rightBorder
{
border-collapse: collapse;
border-right: 1px solid red;
}
.pr-left1
{
padding-left: 1rem;
}
table
{
border-collapse: collapse;
}
tr
{
border: none;
}
<table>
<tr colspan="2" class='colspan2border'><td>Unique values:</td></tr>
<tr>
<td class="rightBorder pr-left1">University</td>
<td>870</td>
</tr>
<tr>
<td class="rightBorder pr-left1">Custom</td>
<td>560</td>
</tr>
</table>
I have created a table however I cannot get the <thead>s to line up with the <tbody>s.
The table is responsive and works as I want it to when resized, however it's the initial screen size that is the issue.
I have added float:left to the <thead>s so they align properly instead of overlapping each other and would like the table data to a-line in the same way.
table {
border: 1px solid #ccc;
border-collapse: collapse;
margin: 0;
padding: 0;
width: 100%;
table-layout: fixed;
}
table caption {
font-size: 1.5em;
margin: .5em 0 .75em;
}
table tr {
background: #f8f8f8;
border: 1px solid #ddd;
padding: .35em;
}
table th,
table td {
padding: .625em;
text-align: center;
}
table td {
font-size: 0.60em;
}
table th {
font-size: .60em;
letter-spacing: .1em;
text-transform: uppercase;
}
#media screen and (max-width: 600px) {
table {
border: 0;
}
table caption {
font-size: 1.3em;
}
table thead {
border: none;
clip: rect(0 0 0 0);
height: 1px;
margin: -1px;
overflow: hidden;
padding: 0;
position: absolute;
width: 1px;
}
table tr {
border-bottom: 3px solid #ddd;
display: block;
margin-bottom: .625em;
}
table td {
border-bottom: 1px solid #ddd;
display: block;
font-size: .8em;
text-align: right;
}
table td:before {
/*
* aria-label has no advantage, it won't be read inside a table
content: attr(aria-label);
*/
content: attr(data-label);
float: left;
font-weight: bold;
text-transform: uppercase;
}
table td:last-child {
border-bottom: 0;
}
#table-wrapper {
position: relative;
}
#table-scroll {
overflow: auto;
}
#table-wrapper table {
width: 100%;
}
#table-wrapper table * {
color: black;
font-size: 12px;
}
#table-wrapper table thead th .text {
text-align: center;
}
}
<div class="col-12 offset-0">
<div style="overflow-x:auto">
<div id="table-wrapper">
<div id="table-scroll">
<table class="table table-striped" border="0" cellspacing="0" cellpadding="0" align="center">
<h4>Success Stream</h4>
<thead style="float:left">
<tr>
<th scope="col">Year</th>
<th scope="col">{{n1}}'s age</th>
<th scope="col">{{n2}}'s age</th>
<th scope="col">Income</th>
<th scope="col">Personal Contribution to Pension</th>
<th scope="col">Company Contribution to Pension</th>
<th scope="col">Personal Contribution to ISA</th>
<th scope="col">Expenses</th>
<th scope="col">Cash Flow</th>
<th scope="col">Growth of Pension</th>
<th scope="col">Growth of ISA</th>
<th scope="col">Growth of Other</th>
<th scope="col">Withdrawals from Pension</th>
<th scope="col">Withdrawals from ISA</th>
<th scope="col">Withdrawals from Other</th>
<th scope="col">Pension Total</th>
<th scope="col">ISA Total</th>
<th scope="col">Other Total</th>
<th scope="col">Full Total</th>
</tr>
</thead>
<tbody>
<tr>
<td data-label="Year"> 2018</td>
<td data-label="{{n1}}'s age">55</td>
<td data-label="{{n2}}'s age">55</td>
<td data-label="Income">57,000</td>
<td data-label="Personal Contribution to Pension">5,000</td>
<td data-label="Company Contribution to Pension">0</td>
<td data-label="Personal Contribution to ISA">0</td>
<td data-label="Expenses">50,500</td>
<td data-label="Cash Flow">1,500</td>
<td data-label="Growth of Pension">57,737</td>
<td data-label="Growth of ISA">0</td>
<td data-label="Growth of Other">0</td>
<td data-label="Withdrawals from Pension">0</td>
<td data-label="Withdrawals from ISA">0</td>
<td data-label="Withdrawals from Other">0</td>
<td data-label="Pension Total">862,737</td>
<td data-label="ISA Total">1</td>
<td data-label="Other Total">1,501</td>
<td data-label="Full Total">864,239</td>
</tr>
</tbody>
</table>
</div>
</div>
</div>
</div>
Instead of using float:left for thead just change
table {
table-layout: fixed;
}
to
table {
table-layout: auto;
}
I have a table with 6 columns and want 3 on both sides to have no border and space between the cells, so at then end having 2 columns with 3 cells on each side.
To keep the border between the rows I let border-collapse:separate and only set border-spacing horizontal to 0px.
But now the two columns with 3 cells on each side also have 0px spacing between them, but what I want them to be 2px (the same spacing as between the rows).
Setting border-spacing back to 2px results in a small gap within the top and bottom border line.
I assume my complete approach with the border-collapse doesn't help me to get the layout I want to.
Any ideas? Here's the fiddle: Link
<fieldset>
<legend>content 1</legend>
<table>
<tr>
<td class="cell1">r1c1</td>
<td class="cell2">r1c2</td>
<td class="cell3">r1c3</td>
<td class="cell4">r1c4</td>
<td class="cell5">r1c5</td>
<td class="cell6">r1c6</td>
</tr>
<tr>
<td class="cell1">r2c1</td>
<td class="cell2">r2c2</td>
<td class="cell3">r2c3</td>
<td class="cell4">r2c4</td>
<td class="cell5">r2c5</td>
<td class="cell6">r2c6</td>
</tr>
<tr>
<td class="cell1">r3c1</td>
<td class="cell2">r3c2</td>
<td class="cell3">r3c3</td>
<td class="cell4">r3c4</td>
<td class="cell5">r3c5</td>
<td class="cell6">r3c6</td>
</tr>
<tr>
<td class="cell1">r4c1</td>
<td class="cell2">r4c2</td>
<td class="cell3">r4c3</td>
<td class="cell4">r4c4</td>
<td class="cell5">r4c5</td>
<td class="cell6">r4c6</td>
</tr>
</table>
</fieldset>
body {
background:white;
//width:950px;
margin:auto;
font:normal normal normal 14px/120% Arial, Helvetica, sans-serif;
padding:20px;
margin-bottom:30px;
}
fieldset {
width:400px;
margin:auto;
}
table {
border-collapse: separate;
border-spacing: 0px 2px;
text-align: center;
}
table td.cell1,table td.cell4 {
border: 1px solid black;
border-right:none;
width:50px;
}
table td.cell2,table td.cell5 {
border: 1px solid black;
border-right:none;
border-left:none;
width:80px;
}
table td.cell3,table td.cell6 {
border: 1px solid black;
border-left:none;
width:60px;
}
It took a while but I found a very simple solution. I just added another cell as 'gap'
Link to fiddle
HTML:
<tr>
<td class="cell1">r1c1</td>
<td class="cell2">r1c2</td>
<td class="cell3">r1c3</td>
<td class="gap_hor"></td>
<td class="cell4">r1c4</td>
<td class="cell5">r1c5</td>
<td class="cell6">r1c6</td>
</tr>
CSS:
table td.gap_hor {
border:none;
width:10px;
}
One, slightly more complex approach, is to use CSS' :nth-child() pseudo-class to style the elements, which has the advantage of being immediately expandable should another three <td> elements be added to the rows:
/* Styling the common features: */
td {
width: 60px;
text-align: center;
border: 1px solid #000;
}
/* removing the border on the left and right of the middle
cell from each group of three: */
td:nth-child(2n) {
border-left-width: 0;
border-right-width: 0;
}
/* removing the right border from the preceding cell: */
td:nth-child(2n-1) {
border-right-width: 0;
}
/* removing the left border from the following cell: */
td:nth-child(2n+1) {
border-left-width: 0;
}
/* restoring the left border on the first cell matched by
the (2n+1) rule: */
td:first-child {
border-left-width: 1px;
}
/* restoring the border-right on the last-cell: */
td:last-child {
border-right-width: 1px;
}
/* adding padding-right to the third of each group of three */
td:nth-child(3n) {
padding-right: 5px;
}
/* adding padding left to the first cell of each group of three,
and relative positioning: */
td:nth-child(3n + 1) {
position: relative;
padding-left: 5px;
}
/* creating a pseudo-element to replace the borders, and
emulate a separating column: */
td:nth-child(3n + 1)::after {
content: '';
position: absolute;
width: 10px;
top: -1px;
bottom: -1px;
left: -5px;
border-left: 1px solid #000;
border-right: 1px solid #000;
background-color: #fff;
}
/* hiding the pseudo-element from the first cell: */
td:first-child::after {
width: 0;
height: 0;
border-width: 0;
}
body {
background: white;
//width:950px;
margin: auto;
font: normal normal normal 14px/120% Arial, Helvetica, sans-serif;
padding: 20px;
margin-bottom: 30px;
}
fieldset {
width: 400px;
margin: auto;
}
table {
border-collapse: separate;
border-spacing: 0px 2px;
text-align: center;
}
td {
width: 60px;
text-align: center;
border: 1px solid #000;
}
td:nth-child(2n) {
border-left-width: 0;
border-right-width: 0;
}
td:nth-child(2n-1) {
border-right-width: 0;
}
td:nth-child(2n+1) {
border-left-width: 0;
}
td:first-child {
border-left-width: 1px;
}
td:last-child {
border-right-width: 1px;
}
td:nth-child(3n) {
padding-right: 5px;
}
td:nth-child(3n + 1) {
position: relative;
padding-left: 5px;
}
td:nth-child(3n + 1)::after {
content: '';
position: absolute;
width: 10px;
top: -1px;
bottom: -1px;
left: -5px;
border-left: 1px solid #000;
border-right: 1px solid #000;
background-color: #fff;
}
td:first-child::after {
width: 0;
height: 0;
border-width: 0;
}
<fieldset>
<legend>content 1</legend>
<table>
<tr>
<td class="cell1">r1c1</td>
<td class="cell2">r1c2</td>
<td class="cell3">r1c3</td>
<td class="cell4">r1c4</td>
<td class="cell5">r1c5</td>
<td class="cell6">r1c6</td>
<td class="cell7">r1c7</td>
<td class="cell8">r1c8</td>
<td class="cell9">r1c9</td>
</tr>
<tr>
<td class="cell1">r2c1</td>
<td class="cell2">r2c2</td>
<td class="cell3">r2c3</td>
<td class="cell4">r2c4</td>
<td class="cell5">r2c5</td>
<td class="cell6">r2c6</td>
<td class="cell7">r2c7</td>
<td class="cell8">r2c8</td>
<td class="cell9">r2c9</td>
</tr>
<tr>
<td class="cell1">r3c1</td>
<td class="cell2">r3c2</td>
<td class="cell3">r3c3</td>
<td class="cell4">r3c4</td>
<td class="cell5">r3c5</td>
<td class="cell6">r3c6</td>
<td class="cell7">r3c7</td>
<td class="cell8">r3c8</td>
<td class="cell9">r3c9</td>
</tr>
<tr>
<td class="cell1">r4c1</td>
<td class="cell2">r4c2</td>
<td class="cell3">r4c3</td>
<td class="cell4">r4c4</td>
<td class="cell5">r4c5</td>
<td class="cell6">r4c6</td>
<td class="cell7">r4c7</td>
<td class="cell8">r4c8</td>
<td class="cell9">r4c9</td>
</tr>
</table>
</fieldset>
Or, with some slightly less complicated selectors:
td {
width: 60px;
text-align: center;
border: 1px solid #000;
border-left-width: 0;
border-right-width: 0;
}
td:first-child {
border-left-width: 1px;
}
td:last-child {
border-right-width: 1px;
}
td:nth-child(3n) {
padding-right: 5px;
}
td:first-child ~ td:nth-child(3n+1) {
padding-left: 5px;
position: relative;
}
td:first-child ~ td:nth-child(3n+1)::before {
content: '';
position: absolute;
top: -1px;
bottom: -1px;
left: -5px;
width: 10px;
background-color: #fff;
border-right: 1px solid #000;
border-left: 1px solid #000;
}
body {
background: white;
//width:950px;
margin: auto;
font: normal normal normal 14px/120% Arial, Helvetica, sans-serif;
padding: 20px;
margin-bottom: 30px;
}
fieldset {
width: 400px;
margin: auto;
}
table {
border-collapse: separate;
border-spacing: 0px 2px;
text-align: center;
}
td {
width: 60px;
text-align: center;
border: 1px solid #000;
border-left-width: 0;
border-right-width: 0;
}
td:first-child {
border-left-width: 1px;
}
td:last-child {
border-right-width: 1px;
}
td:nth-child(3n) {
padding-right: 5px;
}
td:first-child ~ td:nth-child(3n+1) {
padding-left: 5px;
position: relative;
}
td:first-child ~ td:nth-child(3n+1)::before {
content: '';
position: absolute;
top: -1px;
bottom: -1px;
left: -5px;
width: 10px;
background-color: #fff;
border-right: 1px solid #000;
border-left: 1px solid #000;
}
<fieldset>
<legend>content 1</legend>
<table>
<tr>
<td class="cell1">r1c1</td>
<td class="cell2">r1c2</td>
<td class="cell3">r1c3</td>
<td class="cell4">r1c4</td>
<td class="cell5">r1c5</td>
<td class="cell6">r1c6</td>
<td class="cell7">r1c7</td>
<td class="cell8">r1c8</td>
<td class="cell9">r1c9</td>
</tr>
<tr>
<td class="cell1">r2c1</td>
<td class="cell2">r2c2</td>
<td class="cell3">r2c3</td>
<td class="cell4">r2c4</td>
<td class="cell5">r2c5</td>
<td class="cell6">r2c6</td>
<td class="cell7">r2c7</td>
<td class="cell8">r2c8</td>
<td class="cell9">r2c9</td>
</tr>
<tr>
<td class="cell1">r3c1</td>
<td class="cell2">r3c2</td>
<td class="cell3">r3c3</td>
<td class="cell4">r3c4</td>
<td class="cell5">r3c5</td>
<td class="cell6">r3c6</td>
<td class="cell7">r3c7</td>
<td class="cell8">r3c8</td>
<td class="cell9">r3c9</td>
</tr>
<tr>
<td class="cell1">r4c1</td>
<td class="cell2">r4c2</td>
<td class="cell3">r4c3</td>
<td class="cell4">r4c4</td>
<td class="cell5">r4c5</td>
<td class="cell6">r4c6</td>
<td class="cell7">r4c7</td>
<td class="cell8">r4c8</td>
<td class="cell9">r4c9</td>
</tr>
</table>
</fieldset>
I'm working on a stats table for soccer(Football) games.
The table consists of the following columns (from left to right):
icon
text (what happend)
minute
text (what happend)
icon
The icon & minute columns should have a static with (50px & 80px). The text columns should be variable in width.
Now to the tricky part... if the table has a text column with content and one without in the same row the minute column isn't centered anymore. See:
That's how it should look like:
Here is the code:
<table class="table-comparison">
<thead>
<th colspan="5">
Wechsel
</th>
</thead>
<tbody>
<tr>
<td class="column-action"><i class="icon-rotate-left"></i></td>
<td class="column-text text-right">
<i class="icon-caret-right color-green"></i> Sradan Lakic für <i class="icon-caret-right color-red-light"></i> Stefan Aigner
</td>
<td class="column-center" data-toggle="move:insertBefore" data-target="$el.parent().find('td:first-child')">46'</td>
<td class="column-text">
<div>
<i class="icon-caret-right color-green"></i> Mario Götze für <i class="icon-caret-right color-red-light"></i> Toni Kroos
</div>
<div>
<i class="icon-caret-right color-green"></i> Emre Can für <i class="icon-caret-right color-red-light"></i> Thiago Alcantara
</div>
</td>
<td class="column-action"><i class="icon-rotate-left"></i></td>
</tr>
<tr>
<td class="column-action"><i class="icon-rotate-left"></i></td>
<td class="column-text text-right">
<i class="icon-caret-right color-green"></i> Sebastion Jung für <i class="icon-caret-right color-red-light"></i> Marco Russ
</td>
<td class="column-center" data-toggle="move:insertBefore" data-target="$el.parent().find('td:first-child')">88'</td>
<td class="column-text"></td>
<td class="column-action"></td>
</tr>
</tbody>
</table>
and the css:
// ------------------------------
.table-comparison {
color: #black;
width: 100%;
th, td {
padding: 10px 0;
}
th {
.interstate;
.uppercase;
color: #black;
font-size: 14px;
padding-top: 0;
padding-bottom: 15px;
#media #tablet {
padding-bottom: 35px;
text-align: center;
}
}
.column-action {
padding-left: 20px;
padding-right: 20px;
text-align: center;
width: 20px;
#media #phone {
display: none;
}
}
.column-text {
padding-left: 20px;
padding-right: 20px;
#media #phone {
display: block;
height: auto;
text-align: left;
width: 100%;
}
}
.column-center {
.interstate;
text-align: center;
width: 80px;
#media #phone {
display: block;
height: auto;
padding-left: 20px;
text-align: left;
width: 100%;
}
#media #tablet {
border-left: 1px solid #grey-medium;
border-right: 1px solid #grey-medium;
}
}
// stripe that shit down
// stripe down the tables
> tbody > tr:nth-child(even) > td,
> tbody > tr:nth-child(even) > th {
background-color: #f7f7f7;
}
> tbody > tr:nth-child(odd) > td,
> tbody > tr:nth-child(odd) > th {
background-color: transparent;
}
}
use table-layout:fixed; that way, the column that did't get specific width, will 'divide' the rest of the width evenly between them.
Working Fiddle
CSS
.table-comparison
{
width: 100%;
table-layout: fixed;
}
.iconColumn
{
width: 50px; /*fixed width*/
}
.textColumn
{
/*you dont have to fix the width*/
}
.minuteColumn
{
width: 80px; /*fixed width*/
}
/* this part is taken from gvee's solution*/
.table-comparison tr td:first-child, .table-comparison tr td:last-child {
color: red;
background-color: #ddd;
text-align: center;
}
.table-comparison tr td:nth-child(3) {
background-color: lime;
text-align: center;
}
HTML
<table class="table-comparison">
<thead>
<th class='iconColumn'></th>
<th class='textColumn'></th>
<th class='minuteColumn'></th>
<th class='textColumn'></th>
<th class='iconColumn'></th>
</thead>
<tbody>
<tr>
<td><i>i</i></td>
<td></td>
<td>46'</td>
<td>
<div> <i>G</i>Mario Götze für<i>R</i>Toni Kroos</div>
<div> <i>G</i> Emre Can für <i>R</i> Thiago Alcantara</div>
</td>
<td><i>i</i>
</td>
</tr>
<tr>
<td><i>i</i>
</td>
<td></td>
<td>88'</td>
<td></td>
<td></td>
</tr>
</tbody>
</table>