I'm having trouble with a box shadow on hover and table <TD> background.
Here is a fiddle
<table class="table-z">
<tr>
<td class="w6">
<label>
<input type="checkbox" checked>
</label>
</td>
<td class="w7">
</td>
<td class="w10">
Tez Tour
</td>
<td class="w17">
<div>
tez-tour.com
</div>
</td>
<td class="w16">Заказ № 34546</td>
<td class="w22">Стоимость 20 000 ₽</td>
<td class="last orange ">На рассмотрении</td>
</tr>
<tr>
<td class="w6">
<input type="checkbox">
</td>
<td class="w7">
</td>
<td class="w10">Мвидео</td>
<td class="w17">mvideo.ru</td>
<td class="w16">Заказ № 34546</td>
<td class="w22">Стоимость 20 000 ₽</td>
<td class="last red">Отказ</td>
</tr>
</table>
How can I make tr box shadow on hover and save custom backgrounds on td?
Use background color with alpha channel.
background-color: rgba(226, 226, 226, 0.3)
You need to set a z-index for the td that allows the shadow to show on it and not under it
.table-z tr{
height: 50px;
text-align: center;
font-size: 16px;
position: relative;
}
.table-z td {
z-index: -1;
position: relative;
}
.table-z{
margin-top: 10px;
margin-left: 10px;
width: 100%;
}
.w6{
padding-left: 2%;
width: 6%;
background: yellow;
border-left: 1px solid #e1e1e1;
border-top: 1px solid #e1e1e1;
border-bottom: 1px solid #e1e1e1;
}
.w7{
width: 7%;
background: yellow;
border-top: 1px solid #e1e1e1;
border-bottom: 1px solid #e1e1e1;
}
.w10{
width: 10%;
background: yellow;
border-top: 1px solid #e1e1e1;
border-bottom: 1px solid #e1e1e1;
}
.w17{
width: 17%;
background: yellow;
border-right: 1px solid #e1e1e1;
border-top: 1px solid #e1e1e1;
border-bottom: 1px solid #e1e1e1;
}
.w16{
width: 16%;
border-top: 1px solid #e1e1e1;
border-bottom: 1px solid #e1e1e1;
}
.w22{
width: 22%;
border-top: 1px solid #e1e1e1;
border-bottom: 1px solid #e1e1e1;
}
td.last{
text-align: right;
padding-right: 35px;
border-top: 1px solid #e1e1e1;
border-bottom: 1px solid #e1e1e1;
border-right: 1px solid #e1e1e1;
}
.table-z{
border-collapse: collapse
}
.table-z tr:last-child td:first-child {
border-bottom-left-radius: 5px;
}
.table-z tr:last-child td:last-child {
border-bottom-right-radius: 5px;
}
.le{
margin-left: 10px;
width: 240px;
}
table {
border-collapse: collapse;
border-radius: 5px;
border-style: hidden; /* hide standard table (collapsed) border */
box-shadow: 0 0 0 1px #e1e1e1; /* this draws the table border */
}
.table-z tr:hover {
box-shadow: 0px 0px 12px 5px red;
cursor: pointer;
}
<table class="table-z">
<tr>
<td class="w6">
<label>
<input type="checkbox" checked>
</label>
</td>
<td class="w7">
</td>
<td class="w10">
Tez Tour
</td>
<td class="w17">
<div>
tez-tour.com
</div>
</td>
<td class="w16">Заказ № 34546</td>
<td class="w22">Стоимость 20 000 ₽</td>
<td class="last orange ">На рассмотрении</td>
</tr>
<tr>
<td class="w6">
<input type="checkbox">
</td>
<td class="w7">
</td>
<td class="w10">Мвидео</td>
<td class="w17">mvideo.ru</td>
<td class="w16">Заказ № 34546</td>
<td class="w22">Стоимость 20 000 ₽</td>
<td class="last red">Отказ</td>
</tr>
</table>
simply change your tr to td for the hover
.table-z TD:hover {
-webkit-box-shadow: 0px 0px 12px 5px rgba(233,233,233,1);
-moz-box-shadow: 0px 0px 12px 5px rgba(233,233,233,1);
box-shadow: 0px 0px 12px 5px rgba(233,233,233,1);
cursor: pointer;
}
Related
I'm trying to style the bottom border of a TD. The attached image shows this working as I'd like but the border is slightly too long, I'd like it to match the width of the blue cell above it.
Here is my code:
table {
border-collapse: collapse;
width: 100%;
}
.tab {
border-collapse: separate;
background-color: #5B86EE;
text-align: center;
border-width: 1px;
border-bottom: solid 3px #A0A0A0;
border-top: solid 3px #E1E1E1;
border-left: solid 3px #E1E1E1;
border-right: solid 3px #E1E1E1;
display: table-cell;
border-top-left-radius: 5px;
border-top-right-radius: 5px;
}
.active {
background-color: #5B86EE;
text-align: center;
border-width: 1px;
border-bottom-width: 2px;
border-bottom: solid 3px #640000;
border-top: solid 3px #E1E1E1;
border-left: solid 3px #E1E1E1;
border-right: solid 3px #E1E1E1;
border-top-left-radius: 5px;
border-top-right-radius: 5px;
}
<table border="0" width="100%%" align="center">
<tbody>
<tr>
<td class="tab">1</td>
<td class="active">2</td>
<td class="tab">3</td>
</tr>
</tbody>
</table>
I have no control over the HTML being used, but I can change the CSS.
Is there anyway to make the bottom border match the width of the cell excluding the left or right border width ?
Also viewing this in Firefox and the border over hang is on the other end, so on the left not the right.
You could use a pseudo element instead of a bottom border:
table {
border-collapse: collapse;
width: 100%;
}
.active,
.tab {
border-collapse: separate;
background-color: #5B86EE;
text-align: center;
border-width: 1px;
border-bottom: solid 3px #A0A0A0;
border-top: solid 3px #E1E1E1;
border-left: solid 3px #E1E1E1;
border-right: solid 3px #E1E1E1;
border-top-left-radius: 5px;
border-top-right-radius: 5px;
position: relative;
}
.active:after {
content: '';
display: block;
position: absolute;
top: 100%;
left: 0;
right: 0;
border-bottom: solid 3px #640000;
}
<table border="0" width="100%%" align="center">
<tbody>
<tr>
<td class="tab">1</td>
<td class="active">2</td>
<td class="tab">3</td>
</tr>
</tbody>
</table>
here is the codepen, can anyone say why the borders do not display?
I want to achieve this https://codepen.io/javisp91/pen/PmzpLz without the use of class.
I have used nth-of-type and treated the table like a matrix. This code doesn't display borders. What could be overriding?
tr td {
width:100px;
height: 100px;
}
tr: nth-of-type(1) td: nth-of-type(1) {
border-right: 5px solid black;
border-bottom: 5px solid black;
}
tr: nth-of-type(1) td: nth-of-type(2) {
border-bottom: 5px solid black;
border-right: 5px solid black;
border-left: 5px solid black;
}
tr: nth-of-type(1) td: nth-of-type(3) {
border-left: 5px solid black;
border-bottom: 5px solid black;
}
tr: nth-of-type(2) td: nth-of-type(1) {
border-right: 5px solid black;
border-bottom: 5px solid black;
border-top: 5px solid black;
}
tr: nth-of-type(2) td: nth-of-type(2) {
border-bottom: 5px solid black;
border-right: 5px solid black;
border-left: 5px solid black;
border-top: 5px solid black;
}
tr: nth-of-type(2) td: nth-of-type(3) {
border-left: 5px solid black;
border-bottom: 5px solid black;
border-top: 5px solid black;
}
tr: nth-of-type(3) td: nth-of-type(1) {
border-right: 5px solid black;
border-top: 5px solid black;
}
tr: nth-of-type(3) td: nth-of-type(2) {
border-top: 5px solid black;
border-right: 5px solid black;
border-left: 5px solid black;
}
tr: nth-of-type(3) td: nth-of-type(3) {
border-left: 5px solid black;
border-top: 5px solid black;
}
body {
text-align: center;
}
table {
margin: auto;
}
You're not defining them correctly. See the following fork or snippet:
tr td{
width:100px;
height: 100px;
}
tr td{
border-right: 5px solid black;
border-bottom: 5px solid black;
}
tr td:last-child{
border-right:0;
}
tr:last-child td{
border-bottom:0;
}
body{
text-align: center;
}
table{
margin: auto;
}
<h1>Tic Tac Toe</h1>
<table>
<tr>
<td> </td>
<td> </td>
<td> </td>
</tr>
<tr>
<td> </td>
<td> </td>
<td> </td>
</tr>
<tr>
<td> </td>
<td> </td>
<td> </td>
</tr>
</table>
Logic:
Set all tr td with right and bottom border except the last one.
tr td{
border-right: 5px solid black;
border-bottom: 5px solid black;
}
tr td:last-child{
border-right:0;
}
tr:last-child td{
border-bottom:0;
}
Try this code.
table{
margin: auto;
border: solid // you forget this line in your code put this line to show border.
}
below is the code, i had a one image, below that image there is Price and a button, i want some space between price and button which should be left and right to the image
.new {
font: bold 11px Arial;
text-decoration: none;
background-color: #66C4C4;
color: white;
padding: 2px 6px 2px 6px;
border-top: 1px solid #CCCCCC;
border-right: 1px solid #333333;
border-bottom: 1px solid #333333;
border-left: 1px solid #CCCCCC;
.wrapper {
text-align: center;
}
.show{
background-color: #2D318A;
color: white;
padding: 2px 6px 2px 6px;
border-top: 1px solid #CCCCCC;
border-right: 1px solid #333333;
border-bottom: 1px solid #333333;
border-left: 1px solid #CCCCCC;
border-radius: 3px;
text-decoration: none;
float: right;
<div class="wrapper">
New Released
</div>
<img src="https://www.google.com.np/search?q=django+imagefield&source=lnms&tbm=isch&sa=X&ved=0ahUKEwiHk57k89fcAhUJVH0KHbxAC08Q_AUICygC&biw=1396&bih=690#imgrc=3ukNSrarUo82hM:" style="width: 300px" height="200px">
<table>
<tr>
<td>
Price: Rs 14000
</td>
<td> Join Now</td>
</tr>
</table>
Use this approach it will work fine. Best part is you can even adjust its responsiveness with classes. Don't need to use table for such things. That's considered bad code.
You was missing closing bracket of .new class.
.new {
font: bold 11px Arial;
text-decoration: none;
background-color: #66C4C4;
color: white;
padding: 2px 6px 2px 6px;
border-top: 1px solid #CCCCCC;
border-right: 1px solid #333333;
border-bottom: 1px solid #333333;
border-left: 1px solid #CCCCCC;
}
.image-container {
width: 300px;
height: 200px;
}
.image-container img {
width: 100%;
}
.image-container span {
float: left;
}
.show {
float: right;
background-color: #2D318A;
color: white;
padding: 2px 6px 2px 6px;
border-top: 1px solid #CCCCCC;
border-right: 1px solid #333333;
border-bottom: 1px solid #333333;
border-left: 1px solid #CCCCCC;
border-radius: 3px;
text-decoration: none;
<div class="wrapper">
New Released
</div>
<div class="image-container">
<img src="http://site8.dealerbase.co.nz/media/1707/300x200.gif" />
<br>
<span>Price: Rs 14000</span>
Join Now</div>
Thanks
.item-wrap{
display:inline-block;
border:1px solid #ccc;
}
.item-footer{
display:flex;
justify-content:space-around;
}
<div class="item-wrap">
<div class='item-img'>
<img src='https://picsum.photos/300/200?image=0'>
</div>
<div class='item-footer'>
<div class='price'><p>Price: Rs 14000</p></div>
<div class='item-join'>
<p>Join Now</p>
</div>
</div>
</div>
**HTML:**
<tr>
<td>
Price: Rs 14000
</td>
<td class="joinButtonAlign"> Join Now</td>
</tr>
**CSS**
.joinButtonAlign{
display: inline-block;
padding-left:30px;
}
I am looking to apply a shadow only to the line that goes between the table rows. In the sample below the "red" lines. I don't want the shadow to be applied to the blue borders.
If anyone can fiddle the below snippet to get it to work they would be my hero of the day.
EDIT: I see my snippet has the pointed red line problem. Ideally I actually want a solid non divided red line.
This is the sort of effect I'm looking for:
.shadow {
margin: 20px;
width: 80%;
background: yellow;
border-radius: 15px;
border: 2px solid blue;
}
.shadow td, .shadow th {
border-top: 5px solid red;
border-right: 2px solid blue;
padding: 10px;
text-align: center;
}
.shadow th {
border-top: none;
}
.shadow td:last-child, .shadow th:last-child {
border-right: none;
}
<div>
<table class="shadow">
<tr>
<th>AH</th>
<th>BH</th>
<th>CH</th>
</tr>
<tr>
<td>A1</td>
<td>B1</td>
<td>C1</td>
</tr>
<tr>
<td>A2</td>
<td>B2</td>
<td>C2</td>
</tr>
<tr>
<td>A3</td>
<td>B3</td>
<td>C3</td>
</tr>
</table>
</div>
It seems to me the following snippet will solve your problem. Let me know if something is not good or you need something explained. Basically I added the box shadow to all td's and th's, and then I just removed them from the last row using the :last-child selector
EDIT: As suggested in the comments, I have updated the adding only
.shadow tr:not(:last-child) td, .shadow th{
box-shadow: 0px 10px 5px rgba(0,0,0,0.6);
}
which does the trick as well
.shadow {
margin: 20px;
width: 80%;
background: yellow;
border-radius: 15px;
border: 2px solid blue;
}
.shadow td, .shadow th{
border-top: 5px solid red;
border-right: 2px solid blue;
padding: 10px;
text-align: center;
}
.shadow tr:not(:last-child) td, .shadow th{
box-shadow: 0px 10px 5px rgba(0,0,0,0.6);
}
.shadow th {
border-top: none;
}
.shadow td:last-child, .shadow th:last-child {
border-right: none;
}
<div>
<table class="shadow">
<tr>
<th>AH</th>
<th>BH</th>
<th>CH</th>
</tr>
<tr>
<td>A1</td>
<td>B1</td>
<td>C1</td>
</tr>
<tr>
<td>A2</td>
<td>B2</td>
<td>C2</td>
</tr>
<tr>
<td>A3</td>
<td>B3</td>
<td>C3</td>
</tr>
</table>
</div>
Here is my contribution, hope it helps. :)
.table {
margin: 20px;
width: 80%;
background: yellow;
border-radius: 15px;
border: 2px solid blue;
border-spacing: 0px;
}
.table tr {
box-shadow: 0 3px 4px -1px rgba(0,0,0,0.65);
}
.table th, .table td {
padding: 10px;
text-align: center;
border-bottom: 4px solid red;
border-right:2px solid blue;
}
.table tr:last-child td {
border-bottom: none;
}
.table tr td:last-child,
.table tr th:last-child{
border-right: none;
}
.table tr:last-child {
box-shadow: none;
}
<div>
<table class="table">
<tr>
<th>AH</th>
<th>BH</th>
<th>CH</th>
</tr>
<tr>
<td>A1</td>
<td>B1</td>
<td>C1</td>
</tr>
<tr>
<td>A2</td>
<td>B2</td>
<td>C2</td>
</tr>
<tr>
<td>A3</td>
<td>B3</td>
<td>C3</td>
</tr>
</table>
</div>
You could make it with :after pseudo-element and position: absolute:
.shadow {
margin: 20px;
width: 80%;
background: yellow;
border-radius: 15px;
border: 2px solid blue;
}
.shadow td, .shadow th {
border-top: 5px solid red;
border-right: 2px solid blue;
padding: 10px;
text-align: center;
position: relative;
}
.shadow th {
border-top: none;
}
.shadow td:last-child, .shadow th:last-child {
border-right: none;
}
.shadow td:after, .shadow th:after {
content: '';
display: block;
box-shadow: black 1px 3px 3px;
height: 2px;
width: 100%;
position: absolute;
left: 0;
bottom: 0;
}
.shadow tr:last-child td:after, .shadow tr:last-child th:after {
display: none;
}
<div>
<table class="shadow">
<tr>
<th>AH</th>
<th>BH</th>
<th>CH</th>
</tr>
<tr>
<td>A1</td>
<td>B1</td>
<td>C1</td>
</tr>
<tr>
<td>A2</td>
<td>B2</td>
<td>C2</td>
</tr>
<tr>
<td>A3</td>
<td>B3</td>
<td>C3</td>
</tr>
</table>
</div>
I am trying to send a automated report mail with following table, but the width of the columns is far to small for the description fields and I have no idea why this is not adjusting.
I have already tried
width: auto;
width: px;
width: &;
width: 1px;
white-space: nowrap;
Table:
<h1>E-48<h1>
<table stlye='text-align: center; border: 1px solid lightblue; padding: 2px 10px 2px 10px; border-collapse: collapse;
white-space: nowrap; table-layout:fixed;'><tr>
<td style='text-align: center; border: 1px solid lightblue; padding: 2px 10px 2px 10px; width: 100%;'></td>
<td style='text-align: center; border: 1px solid lightblue; padding: 2px 10px 2px 10px; width: 100%;'>Spinner temperature</td>
<td style='text-align: center; border: 1px solid lightblue; padding: 2px 10px 2px 10px; width: 100%;'>Front bearing temperature</td>
<td style='text-align: center; border: 1px solid lightblue; padding: 2px 10px 2px 10px; width: 100%;'>Pitch cabinet blade B temperature</td>
<td style='text-align: center; border: 1px solid lightblue; padding: 2px 10px 2px 10px; width: 100%;'>Pitch cabinet blade C temperature</td>
<td style='text-align: center; border: 1px solid lightblue; padding: 2px 10px 2px 10px; width: 100%;'>Blade A temperature</td>
<td style='text-align: center; border: 1px solid lightblue; padding: 2px 10px 2px 10px; width: 100%;'>Blade B temperature</td>
<td style='text-align: center; border: 1px solid lightblue; padding: 2px 10px 2px 10px; width: 100%;'>Blade C temperature</td>
<td style='text-align: center; border: 1px solid lightblue; padding: 2px 10px 2px 10px; width: 100%;'>Rotor temperature 1</td>
<td style='text-align: center; border: 1px solid lightblue; padding: 2px 10px 2px 10px; width: 100%;'>Rotor temperature 2</td>
<td style='text-align: center; border: 1px solid lightblue; padding: 2px 10px 2px 10px; width: 100%;'>Stator temperature 1</td>
<td style='text-align: center; border: 1px solid lightblue; padding: 2px 10px 2px 10px; width: 100%;'>Stator temperature 2</td>
<td style='text-align: center; border: 1px solid lightblue; padding: 2px 10px 2px 10px; width: 100%;'>Nacelle ambient temperatur</td>
<td style='text-align: center; border: 1px solid lightblue; padding: 2px 10px 2px 10px; width: 100%;'>Rear bearing temperature</td>
<td style='text-align: center; border: 1px solid lightblue; padding: 2px 10px 2px 10px; width: 100%;'>Nacelle temperature</td>
<td style='text-align: center; border: 1px solid lightblue; padding: 2px 10px 2px 10px; width: 100%;'>Nacelle cabinet temperature</td>
<td style='text-align: center; border: 1px solid lightblue; padding: 2px 10px 2px 10px; width: 100%;'>Rectifier 1 heat sink temperature</td>
<td style='text-align: center; border: 1px solid lightblue; padding: 2px 10px 2px 10px; width: 100%;'>Rectifier 2 heat sink temperature</td>
<td style='text-align: center; border: 1px solid lightblue; padding: 2px 10px 2px 10px; width: 100%;'>Rectifier cabinet temperature</td>
<td style='text-align: center; border: 1px solid lightblue; padding: 2px 10px 2px 10px; width: 100%;'>Excitation heat sink temperature</td>
<td style='text-align: center; border: 1px solid lightblue; padding: 2px 10px 2px 10px; width: 100%;'>Ambient temperature</td>
<td style='text-align: center; border: 1px solid lightblue; padding: 2px 10px 2px 10px; width: 100%;'>Tower temperature</td>
<td style='text-align: center; border: 1px solid lightblue; padding: 2px 10px 2px 10px; width: 100%;'>Control cabinet temperature</td>
<td style='text-align: center; border: 1px solid lightblue; padding: 2px 10px 2px 10px; width: 100%;'>Transformer temperature</td>
<td style='text-align: center; border: 1px solid lightblue; padding: 2px 10px 2px 10px; width: 100%;'>Inverter 1 cabinet temperature</td>
<td style='text-align: center; border: 1px solid lightblue; padding: 2px 10px 2px 10px; width: 100%;'>Inverter 2 cabinet temperature</td>
<td style='text-align: center; border: 1px solid lightblue; padding: 2px 10px 2px 10px; width: 100%;'>Pitch heat sink blade A temperature</td>
<td style='text-align: center; border: 1px solid lightblue; padding: 2px 10px 2px 10px; width: 100%;'>Inverter 3 cabinet temperature</td>
<td style='text-align: center; border: 1px solid lightblue; padding: 2px 10px 2px 10px; width: 100%;'>Pitch heat sink blade B temperature</td>
<td style='text-align: center; border: 1px solid lightblue; padding: 2px 10px 2px 10px; width: 100%;'>Pitch heat sink blade C temperature</td>
<td style='text-align: center; border: 1px solid lightblue; padding: 2px 10px 2px 10px; width: 100%;'>Pitch cabinet blade A temperature</td>
https://developer.mozilla.org/en-US/docs/Web/CSS/table-layout
"Under the "fixed" layout method, the entire table can be rendered once the first table row has been downloaded and analyzed. This can speed up rendering time over the "automatic" layout method, but subsequent cell content may not fit in the column widths provided."
Your first table row is empty.
Add a width to your table. <table width="100%"...