I have table with two row, one row has class another has no class.
I want add hover property to my table but it just work on row without class.
what should I do?
.datagrid table {
border-collapse: collapse;
text-align: center;
width: 100%;
}
.datagrid {
font: normal 12px/150% B Yekan;
background: #fff;
overflow: hidden;
border: 1px solid #36752D;
-webkit-border-radius: 3px;
-moz-border-radius: 3px;
border-radius: 3px;
}
.datagrid table td,
.datagrid table th {
padding: 3px 10px;
}
.datagrid table thead th {
background: -webkit-gradient(linear, left top, left bottom, color-stop(0.05, #36752D), color-stop(1, #275420));
background: -moz-linear-gradient(center top, #36752D 5%, #275420 100%);
filter: progid: DXImageTransform.Microsoft.gradient(startColorstr='#36752D', endColorstr='#275420');
background-color: #36752D;
color: #FFFFFF;
font-size: 15px;
font-weight: bold;
border-left: 1px solid #36752D;
}
.datagrid table tbody td {
color: #275420;
border-left: 1px solid #C6FFC2;
font-size: 12px;
font-weight: normal;
}
.datagrid table tbody .alt td {
background: #DFFFDE;
color: #275420;
}
.datagrid table tbody td:first-child {
width: 35px;
text-align: center;
}
.datagrid table tbody td:last-child {
width: 35px;
text-align: center;
}
.datagrid table tbody tr:last-child td {
border-bottom: none;
}
.datagrid table tfoot td div {
border-top: 1px solid #36752D;
background: #DFFFDE;
}
.datagrid table tfoot td {
padding: 0;
font-size: 12px
}
.datagrid table tfoot td div {
padding: 2px;
}
.datagrid table tfoot input {
font-weight: bolder;
cursor: pointer;
display: inline;
text-decoration: none;
display: inline-block;
padding: 6px 12px;
margin: 1px;
color: #FFFFFF;
border: 1px solid #36752D;
-webkit-border-radius: 3px;
-moz-border-radius: 3px;
border-radius: 3px;
background: -webkit-gradient(linear, left top, left bottom, color-stop(0.05, #36752D), color-stop(1, #275420));
background: -moz-linear-gradient(center top, #36752D 5%, #275420 100%);
filter: progid: DXImageTransform.Microsoft.gradient(startColorstr='#36752D', endColorstr='#275420');
background-color: #36752D;
}
.datagrid table tbody tr:hover {
background: #FFF380;
}
.datagrid table tbody .alt:hover {
background: #FFF380;
}
<div class="datagrid">
<table>
<thead>
<tr>
<th style="text-align: center;width: 10%;">row</th>
<th style="text-align: center;width: 20%;">date</th>
<th style="text-align: center;width:10%;">correct</th>
<th style="text-align: center;width: 10%;">wront</th>
<th style="text-align: center;width: 10%;">blank</th>
<th style="text-align: center;width: 10%;">score</th>
<th style="text-align: center;width: 30%;">detail</th>
</tr>
</thead>
<tbody>
<tr class="alt">
<td>1</td>
<td>das</td>
<td>correct</td>
<td>wrong</td>
<td>blank</td>
<td>score</td>
<td><a href "#">page<a></td>
</tr>
<tr>
<td>1</td><td>das</td><td>correct</td>
<td>wrong</td><td>blank</td>
<td>score</td>
<td><a href"#">page<a></td>
</tr>
</tbody>
</table></div>
your tr background is actually getting changed, but you have defined a background color for the td in the tr... because of that, you can't see the changed color! :)
.datagrid table {
border-collapse: collapse;
text-align: center;
width: 100%;
}
.datagrid {
font: normal 12px/150% B Yekan;
background: #fff;
overflow: hidden;
border: 1px solid #36752D;
-webkit-border-radius: 3px;
-moz-border-radius: 3px;
border-radius: 3px;
}
.datagrid table td,
.datagrid table th {
padding: 3px 10px;
}
.datagrid table thead th {
background: -webkit-gradient(linear, left top, left bottom, color-stop(0.05, #36752D), color-stop(1, #275420));
background: -moz-linear-gradient(center top, #36752D 5%, #275420 100%);
filter: progid: DXImageTransform.Microsoft.gradient(startColorstr='#36752D', endColorstr='#275420');
background-color: #36752D;
color: #FFFFFF;
font-size: 15px;
font-weight: bold;
border-left: 1px solid #36752D;
}
.datagrid table tbody td {
color: #275420;
border-left: 1px solid #C6FFC2;
font-size: 12px;
font-weight: normal;
}
.datagrid table tbody .alt {
background: #DFFFDE;
color: #275420;
}
.datagrid table tbody td:first-child {
width: 35px;
text-align: center;
}
.datagrid table tbody td:last-child {
width: 35px;
text-align: center;
}
.datagrid table tbody tr:last-child td {
border-bottom: none;
}
.datagrid table tfoot td div {
border-top: 1px solid #36752D;
background: #DFFFDE;
}
.datagrid table tfoot td {
padding: 0;
font-size: 12px
}
.datagrid table tfoot td div {
padding: 2px;
}
.datagrid table tfoot input {
font-weight: bolder;
cursor: pointer;
display: inline;
text-decoration: none;
display: inline-block;
padding: 6px 12px;
margin: 1px;
color: #FFFFFF;
border: 1px solid #36752D;
-webkit-border-radius: 3px;
-moz-border-radius: 3px;
border-radius: 3px;
background: -webkit-gradient(linear, left top, left bottom, color-stop(0.05, #36752D), color-stop(1, #275420));
background: -moz-linear-gradient(center top, #36752D 5%, #275420 100%);
filter: progid: DXImageTransform.Microsoft.gradient(startColorstr='#36752D', endColorstr='#275420');
background-color: #36752D;
}
.datagrid table tbody tr:hover {
background: #FFF380;
}
.datagrid table tbody .alt:hover {
background: #FFF380;
}
<div class="datagrid">
<table>
<thead>
<tr>
<th style="text-align: center;width: 10%;">row</th>
<th style="text-align: center;width: 20%;">date</th>
<th style="text-align: center;width:10%;">correct</th>
<th style="text-align: center;width: 10%;">wront</th>
<th style="text-align: center;width: 10%;">blank</th>
<th style="text-align: center;width: 10%;">score</th>
<th style="text-align: center;width: 30%;">detail</th>
</tr>
</thead>
<tbody>
<tr class="alt">
<td>1</td>
<td>das</td>
<td>correct</td>
<td>wrong</td>
<td>blank</td>
<td>score</td>
<td><a href "#">page<a></td>
</tr>
<tr>
<td>1</td><td>das</td><td>correct</td>
<td>wrong</td><td>blank</td>
<td>score</td>
<td><a href"#">page<a></td>
</tr>
</tbody>
</table></div>
that code should work... ijust removed the styling from the tr td and changed it to just the td
You have to add the background color to the td like this:
.datagrid table tbody .alt:hover td {
background: #FFF380!important;
}
Add this code
.datagrid table tbody .alt:hover td {
background: #fff380 none repeat scroll 0 0;
}
Instead of
.datagrid table tbody .alt:hover {
background: #FFF380;
}
You can actually do this quite easily with CSS!
This is actually a really simple problem, but I'll explain it with a bit of detail for you.
You have your table row setup with background-colors, as do your table cells. So if you were to hover over a table row, that would change the table row's background-color, leaving the table cell's background color the same. This is why you aren't seeing any changes happening.
You can go about this in two ways:
Set the background-color of your table cells to "transparent" and allow the background-color of the row to come forward.
(This method's the best if your table cells are multiple colors), setup your table row's hover class like this:
.datagrid tr:hover td
{
background-color:#``f2e8da;
}
With your style rule setup like this, when the table row's hovered over, it will effect its child cells color!
That also work fine for me :
.table-hover tbody tr:hover td {
background: #f9f9f9;
}
Related
I have a table that appears to have rows with different sizes. I would like to place a shadow box-shadow: 0 0 13px black around each blue border.
Simply putting the shadow on tr obviously doesn't do it:
I have tried to play with the shadow on td but without success, mostly because the shadow bleeds between cells.
Any ways to do that?
My code below.
<table>
<tbody>
<tr class="A">
<td>A1</td><td>A2</td><td>A3</td><td>A4</td>
</tr>
<tr class="B">
<td></td><td>B2</td><td>B3</td><td>B4</td>
</tr>
<tr class="C">
<td></td><td></td><td>C3</td><td>C4</td>
</tr>
<tr class="D">
<td>D1</td><td>D2</td><td>D3</td><td>D4</td>
</tr>
</tbody>
</table>
table {
border-collapse: separate;
border-spacing: 0 20px;
width: 300px;
text-align: center;
}
tr {
height: 40px;
/* box-shadow: 0 0 13px black; */
}
td {
border-top: 2px solid blue;
border-bottom: 2px solid blue;
}
td:last-child {
border-right: 2px solid blue;
}
.A td:nth-child(1) {border-left: 2px solid blue;}
.B td:nth-child(1) {border: none;}
.B td:nth-child(2) {border-left: 2px solid blue;}
.C td:nth-child(1) {border: none;}
.C td:nth-child(2) {border: none;}
.C td:nth-child(3) {border-left: 2px solid blue;}
.D td:nth-child(1) {border-left: 2px solid blue;}
You have to use the CSS filter property on the tr element to make shadows as you wanted.
CSS shadow on tr element
tr {filter: drop-shadow(5px 5px 5px #222222);}
Im pretty sure you can't do it without javascript because you need extra element between rows. You can do it like this:
$("tr").each(function() {
$("<div class='clearfix'></div>").insertBefore(this);
})
table, tr, td {
box-sizing:border-box;
}
.clearfix:before, .clearfix:after {
content: '.';
display: block;
overflow: hidden;
visibility: hidden;
font-size: 0;
line-height: 0;
width: 0;
height: 0;
}
.clearfix:after {
clear: both;
}
table {
border:2px solid #0f0;
padding:0 10px;
}
table tr {
float:right;
box-shadow:0px 0px 10px rgba(0,0,0,0.4);
margin:10px 0;
}
table td {
width:100px;
text-align:center;
border:2px solid #f00;
}
table td:empty {
display:none;
}
<script src="https://cdnjs.cloudflare.com/ajax/libs/jquery/3.3.1/jquery.min.js"></script>
<table>
<tbody>
<tr class="A">
<td>A1</td><td>A2</td><td>A3</td><td>A4</td>
</tr>
<tr class="B">
<td></td><td>B2</td><td>B3</td><td>B4</td>
</tr>
<tr class="C">
<td></td><td></td><td>C3</td><td>C4</td>
</tr>
<tr class="D">
<td>D1</td><td>D2</td><td>D3</td><td>D4</td>
</tr>
</tbody>
</table>
So I'm building a web shop cart (using Bootstrap 4.1) and I have to make a list of items in the cart with quantity, the price and total-price... I've decided to use a table for this and ran into an following problem:
I'm trying to make a table that has to look like this:
and my best attempt gave me a table that looks like this..:
My question to you fellow internet strangers is how do I make the table borders surounding the "quantity" to look like in the first picture???
and how do I merge the last cells to get the total price (23,97 €) alighned in the middle of the table like in the first picture??
P.S. Is using a table even a corect choice or should I have used a different element like an or ?
Thanks in advance fellow spacemans :)
My Code:
HTML:
<div class="table-responsive">
<table class="table">
<thead>
<tr>
<th scope="col"> </th>
<th scope="col">Product</th>
<th scope="col">Quantity</th>
<th scope="col">Price</th>
</tr>
</thead>
<tbody>
<tr>
<th scope="row">#</th>
<td>100 % Mango</td>
<td>1 X</td>
<td>12.99 €</td>
</tr>
<tr>
<th scope="row">#</th>
<td>Vanilla</td>
<td>2 x</td>
<td>10.98 €</td>
</tr>
</tbody>
</table>
</div>
SCSS:
.table {
border-right: 1px solid #000000;
background-color: transparent;
color: #000000;
text-align: center;
thead {
font-family: 'Alegreya', serif;
border: none;
th {
border: none;
}
}
tbody {
font-weight: 700;
text-transform: uppercase;
border: none;
font-size: 1.5rem;
th, td {
border: none;
&:nth-child(3) {
border-right: 2px solid #000000;
border-left: 2px solid #000000;
}
}
}
}
You can achieve that using :after as described below, and using normal border-right for the forth row.
with :after
td{
position:relative; //positioning the td so that the :after would use it for absolute positioning
//for the small borders on 2nd and 3rd columns
&:nth-child(2):after,&:nth-child(3):after{
content:'';
width:2px;
height:20px;
background:#000;
display:block;
position:absolute;
top:50%;
right:0;
transform:translateY(-50%); //moving the element back up by half its height to center it vertically
}
//for the big border on the 4th column
&:nth-child(4){
border-right:2px solid #000; //do that for the th aswell
}
}
Full Code:
.table {
border-right: 1px solid #000000;
background-color: transparent;
color: #000000;
text-align: center;
thead {
font-family: 'Alegreya', serif;
border: none;
th {
border: none;
&:nth-child(4){
border-right:2px solid #000;
}
}
}
tbody {
font-weight: 700;
text-transform: uppercase;
border: none;
font-size: 1.5rem;
td{
position:relative;
&:nth-child(2):after,&:nth-child(3):after{
content:'';
width:2px;
height:20px;
background:#000;
display:block;
position:absolute;
top:50%;
right:0;
transform:translateY(-50%);
}
&:nth-child(4){
border-right:2px solid #000;
}
}
th, td {
border: none;
}
}
}
Here us working one:https://jsfiddle.net/b2f03y1p/17/
Instead this code:
&:nth-child(3) {
border-right: 2px solid #000000;
border-left: 2px solid #000000;
}
Use this code:
td:nth-child(2):after,td:nth-child(3):after{
content: '';
height: 21px;
width: 2px;
background-color: black;
position: absolute;
top: 35%;
left: 90%;
}
td:nth-child(4):after{
content: '';
height: 100%;
width: 2px;
background-color: black;
position: absolute;
left: 90%;
}
I have a table with a first and a last row with background-color which I would like to have a space with their previous rows.
This is my code:
table {
border-collapse: collapse;
}
thead > tr > th {
font-size: 14px;
color: blue;
height: 44px;
vertical-align: middle;
text-align: left;
padding: 0 10px;
text-align: center;
border: none;
border-bottom: 1px solid blue;
position: relative;
}
thead > tr > th:after {
content: "";
position: absolute;
left: 100%;
top: 8px;
bottom: 8px;
width: 1px;
border-left: 1px dashed blue;
}
thead > tr > th:last-child::after {
border-left: none;
}
tbody > tr:first-child, tbody > tr:last-child {
background-color: gray;
}
tbody > tr:first-child > td, tbody > tr:last-child > td {
border-bottom: none;
color: black;
}
tbody > tr > td {
font-size: 12px;
line-height: 14px;
color: gray;
height: 44px;
vertical-align: middle;
padding: 8px 10px;
border: none;
border-bottom: 1px dashed gray;
position: relative;
}
tbody > tr > td:first-child {
color: black;
}
tbody > tr > td::after {
content: "";
position: absolute;
left: 100%;
top: 8px;
bottom: 8px;
width: 1px;
border-left: 1px dashed gray;
}
tbody > tr > td:last-child::after {
border-left: none;
}
<table>
<thead>
<tr>
<th>Column 1</th>
<th>Column 2</th>
<th>Column 3</th>
</tr>
</thead>
<tbody>
<tr>
<td>6546</td>
<td>5654</td>
<td>6454</td>
</tr>
<tr>
<td>6546</td>
<td>5654</td>
<td>6454</td>
</tr>
<tr>
<td>6546</td>
<td>5654</td>
<td>6454</td>
</tr>
<tr>
<td>6546</td>
<td>5654</td>
<td>6454</td>
</tr>
</tbody>
</table>
So I would like to have a white space between the blue border-bottom of the thead and the first gray row. Also between the last gray row and the previous dashed gray border-bottom. How can I do that?
Hope this helps
change border-collapse: collapse; to border-collapse: separate; and add border-spacing 0 border-spacing.Then apply border-top: 4px solid #fff; for tbody > tr:first-child > td, tbody > tr:last-child > td.
table {
border-collapse: separate;
border-spacing: 0px;
}
tbody > tr:first-child > td, tbody > tr:last-child > td {
border-bottom: none;
color: black;
border-top: 4px solid #fff;
}
table {
border-collapse: separate;
border-spacing: 0px;/* horizontal <length> | vertical <length> */
}
thead > tr > th {
font-size: 14px;
color: blue;
height: 44px;
vertical-align: middle;
text-align: left;
padding: 0 10px;
text-align: center;
border: none;
border-bottom: 1px solid blue;
position: relative;
}
thead > tr > th:after {
content: "";
position: absolute;
left: 100%;
top: 8px;
bottom: 8px;
width: 1px;
border-left: 1px dashed blue;
}
thead > tr > th:last-child::after {
border-left: none;
}
tbody > tr:first-child, tbody > tr:last-child {
background-color: gray;
}
tbody > tr:first-child > td, tbody > tr:last-child > td {
border-bottom: none;
color: black;
border-top: 4px solid #fff;
}
tbody > tr > td {
font-size: 12px;
line-height: 14px;
color: gray;
height: 44px;
vertical-align: middle;
padding: 8px 10px;
border: none;
border-bottom: 1px dashed gray;
position: relative;
}
tbody > tr > td:first-child {
color: black;
}
tbody > tr > td::after {
content: "";
position: absolute;
left: 100%;
top: 8px;
bottom: 8px;
width: 1px;
border-left: 1px dashed gray;
}
tbody > tr > td:last-child::after {
border-left: none;
}
<table>
<thead>
<tr>
<th>Column 1</th>
<th>Column 2</th>
<th>Column 3</th>
</tr>
</thead>
<tbody>
<tr>
<td>6546</td>
<td>5654</td>
<td>6454</td>
</tr>
<tr>
<td>6546</td>
<td>5654</td>
<td>6454</td>
</tr>
<tr>
<td>6546</td>
<td>5654</td>
<td>6454</td>
</tr>
<tr>
<td>6546</td>
<td>5654</td>
<td>6454</td>
</tr>
</tbody>
</table>
Refer this link Spacing between thead and tbody
tbody:before {
content: "-";
display: block;
line-height: 1em;
color: transparent;
}
For some reason these 2 tables won't center, I tried the bootstrap container class, tried margin 0 auto. But they won't center smack in the middle, any idea?
I want both tables centered and displayed horizontally in the middle side by side.
It's on codepen over here:
enter link description here
http://codepen.io/Satearn/pen/ybvXLR
.z
{position :absolute ;
top:50%;
left:50%;
transform :translate(-50%,-50%) ;}
To centre align them just remove width: 100%; from your following CSS code.
.table-fill {
background: white;
border-radius:3px;
border-collapse: collapse;
height: 320px;
margin: auto;
max-width: 300px;
padding:5px;
width: 100%;
box-shadow: 0 5px 10px rgba(0, 0, 0, 0.1);
animation: float 5s infinite;
}
Like this? I used Bootstrap. And I reduced the data inside the table for simplicity
html {
background-color: #3e94ec;
}
/*** Table Styles **/
.table-fill {
border-radius: 3px;
border-collapse: collapse;
padding: 5px;
}
th {
color: #D5DDE5;
background: #1b1e24;
border-bottom: 4px solid #9ea7af;
border-right: 1px solid #343a45;
font-size: 23px;
font-weight: 100;
padding: 24px;
text-align: left;
text-shadow: 0 1px 1px rgba(0, 0, 0, 0.1);
vertical-align: middle;
}
th:first-child {
border-top-left-radius: 3px;
}
th:last-child {
border-top-right-radius: 3px;
border-right: none;
}
tr {
border-top: 1px solid #C1C3D1;
border-bottom-: 1px solid #C1C3D1;
color: #666B85;
font-size: 16px;
font-weight: normal;
text-shadow: 0 1px 1px rgba(256, 256, 256, 0.1);
}
tr:hover td {
background: #4E5066;
color: #FFFFFF;
border-top: 1px solid #22262e;
border-bottom: 1px solid #22262e;
}
tr:first-child {
border-top: none;
}
tr:last-child {
border-bottom: none;
}
tr:nth-child(odd) td {
background: #EBEBEB;
}
tr:nth-child(odd):hover td {
background: #4E5066;
}
tr:last-child td:first-child {
border-bottom-left-radius: 3px;
}
tr:last-child td:last-child {
border-bottom-right-radius: 3px;
}
td {
background: #FFFFFF;
padding: 20px;
text-align: left;
vertical-align: middle;
font-weight: 300;
font-size: 18px;
text-shadow: -1px -1px 1px rgba(0, 0, 0, 0.1);
border-right: 1px solid #C1C3D1;
}
td:last-child {
border-right: 0px;
}
th.text-left {
text-align: left;
}
th.text-center {
text-align: center;
}
th.text-right {
text-align: right;
}
td.text-left {
text-align: left;
}
td.text-center {
text-align: center;
}
td.text-right {
text-align: right;
}
.middlepage {
margin: 0 auto;
}
#outer-cont {
text-align: center;
}
#target-element-to-center {
display: inline-block;
}
<link href="https://maxcdn.bootstrapcdn.com/bootstrap/3.3.7/css/bootstrap.min.css" rel="stylesheet"/>
<div class="container-fluid">
<div class="row">
<table class="table-fill col-xs-6" id="a">
<thead>
<tr>
<th class="text-center" colspan="2">Month</th>
</tr>
</thead>
<tbody class="table-hover">
<tr>
<td class="text-left">January</td>
<td class="text-left">$ 50,000.00</td>
</tr>
</tbody>
</table>
<table class="table-fill col-xs-6" id="a">
<thead>
<tr>
<th class="text-center" colspan="2">Strategies</th>
</tr>
</thead>
<tbody class="table-hover">
<tr>
<td class="text-left">January</td>
<td class="text-left">$ 50,000.00</td>
</tr>
</tbody>
</table>
</div>
</div>
I have a table and I applied the border on td elements inside of it, now when I hover a td I want the tr to be selected by changing the borders of td elements inside, but the right border of a td is on top of the bottom border, so the corner doesn't change color, and I do not want this to happen. Any ideas?
CSS
.advertisements table {
text-align: center;
font-size: 16px;
border-collapse: collapse;
width: 100%;
margin-top: 10px;
}
.advertisements table td {
border: 2px solid #F3FAFF;
padding: 10px;
}
.advertisements table tr {
background-color: #9EC630;
background: -moz-linear-gradient(#9EC630, #87AB29);
background: -o-linear-gradient(#9EC630, #87AB29);
background: -webkit-linear-gradient(#9EC630, #87AB29);
background: -webkit-gradient(linear, left top, left bottom, color-stop(0, #9EC630), color-stop(1, #87AB29));
filter: "progid:DXImageTransform.Microsoft.gradient(startColorStr=#9EC630, EndColorStr=#87AB29)";
background: linear-gradient(#9EC630, #87AB29);
}
.advertisements table tr:not(:first-child):hover {
background-color: #B8D669;
background: -moz-linear-gradient(#B8D669, #9EC630);
background: -o-linear-gradient(#B8D669, #9EC630);
background: -webkit-linear-gradient(#B8D669, #9EC630);
background: -webkit-gradient(linear, left top, left bottom, color-stop(0, #B8D669), color-stop(1, #9EC630));
filter: "progid:DXImageTransform.Microsoft.gradient(startColorStr=#B8D669, EndColorStr=#9EC630)";
background: linear-gradient(#B8D669, #9EC630);
}
.advertisements table tr:not(:first-child):hover td {
border-top: 2px solid #1A446C;
border-bottom: 2px solid #1A446C;
cursor: pointer;
}
.advertisements table tr:not(:first-child):hover td:first-child {
border-left: 2px solid #1A446C;
}
.advertisements table tr:not(:first-child):hover td:last-child {
border-right: 2px solid #1A446C;
}
.advertisements table tr td ~ table tr:not(:first-child):hover {
border-top: none;
}
.advertisements table tr:first-child:hover {
cursor: default;
}
HTML:
<div class="advertisements">
<table>
<tr>
<td>1</td>
<td>2</td>
<td>3</td>
<td>4</td>
</tr>
<tr>
<td>1</td>
<td>2</td>
<td>3</td>
<td>4</td>
</tr>
<tr>
<td>1</td>
<td>2</td>
<td>3</td>
<td>4</td>
</tr>
</table>
</div>
Source is here: http://dabblet.com/gist/c0a22609e6139ad83546
The answer to your question lies in the way browsers resolve border conflicts.
You can set the tr border to be a bit wider, or change the border-style, etc...
If you're unhappy with any of these, I suggest looking at a more complex solution, like border gradients.
Check if this could help you.
DEMO
HTML
<div class="advertisements">
<table cellspacing="0" cellpadding="0" >
<tr>
<td><div>1</div></td>
<td><div>2</div></td>
<td><div>3</div></td>
<td><div>4</div></td>
</tr>
<tr>
<td><div>1</div></td>
<td><div>2</div></td>
<td><div>3</div></td>
<td><div>4</div></td>
</tr>
<tr>
<td><div>1</div></td>
<td><div>2</div></td>
<td><div>3</div></td>
<td><div>4</div></td>
</tr>
</table>
</div>
CSS
.advertisements table {
text-align: center;
font-size: 16px;
/* border-collapse: collapse; */
width: 100%;
margin-top: 10px;
}
.advertisements div {
background-color: #9EC630;
background: -moz-linear-gradient(#9EC630, #87AB29);
background: -o-linear-gradient(#9EC630, #87AB29);
background: -webkit-linear-gradient(#9EC630, #87AB29);
background: -webkit-gradient(linear, left top, left bottom, color-stop(0, #9EC630), color-stop(1, #87AB29));
filter: "progid:DXImageTransform.Microsoft.gradient(startColorStr=#9EC630, EndColorStr=#87AB29)";
background: linear-gradient(#9EC630, #87AB29);
border-bottom: 2px solid #fff;
border-top: 2px solid #fff;
padding: 10px;
position: relative;
}
.advertisements div:after {
width: 4px;
background: #fff;
content: " ";
height: 100%;
position: absolute;
top: 0;
right: 0;
}
.advertisements tr:hover div {
border-color: #1A446C
}
.advertisements tr:hover td:first-child div:before {
width: 2px;
background: #1A446C;
content: " ";
height: 100%;
position: absolute;
top: 0;
left: 0;
}
.advertisements td:last-child div:after {
display: none
}
.advertisements tr:hover td:last-child div:after {
width: 2px;
background: #1A446C;
height: 100%;
position: absolute;
top: 0;
right: 0;
display: block;
}
I find this question quite interesting so I tried to do some edits to it.
I didn't find the solution you are looking for yet, but I found out something interesting for me at least:
If you set the borders of td to be 1px wide at start and the hover ones to be 2px wide it works quite fine I would say: http://jsfiddle.net/Ax9eL/6/
But yeah this solution makes the table move which is not good/nice.
One more thing I tried border-collapse: separate; border-spacing:0px; instead of border-collapse: collapse; which doesn't look very good either: http://jsfiddle.net/Ax9eL/15/
Hope that someone might come up with better solutions ;)