I have a table with headers and each header contains a span which have a background image that i use as a sperator between the th.
On all browsers it display as it should but on IE7 the seperator image (which is a span with background)
is showing on the bottom.
Good (IE8+,Chrome,FF):
Bad (IE7):
HTML:
<div class="tableWrapper">
<table>
<thead>
<tr>
<th class="sortable top-left-round">Lead Id<span></span></th>
<th class="sortable">Create Date<span></span></th>
<th class="sortable">Target Group<span></span></th>
<th class="sortable">Activity<span></span></th>
<th class="sortable">Type<span></span></th>
<th class="sortable">Last Update<span></span></th>
<th class="sortable">Close Date<span></span></th>
<th class="action_header_short top-right-round"><span>View</span></th>
</tr>
</thead>
<tbody>
<tr class="first">
<td>1</td>
<td class="col_name" title="Jackson">10/12/2011</td>
<td title="Jackson">Jackson</td>
<td title="Jackson">Jackson </td>
<td title="Jackson">Jackson</td>
<td title="Jackson">10/12/2011</td>
<td title="Jackson">10/12/2011</td>
<td class="action"></td>
</tr>
<tr>
<td>1</td>
<td class="col_name" title="Jackson">10/12/2011</td>
<td title="Jackson">Jackson</td>
<td title="Jackson">Jackson </td>
<td title="Jackson">Jackson</td>
<td title="Jackson">10/12/2011</td>
<td title="Jackson">10/12/2011</td>
<td class="action"></td>
</tr>
</tbody>
</table>
</div>
<!-- end .tableWrapper -->
CSS:
table{
width: 890px;
margin-left: 25px;
border-collapse:collapse;
}
td{
border: 1px solid #99a3a7;
}
.top-left-round{
-moz-border-radius-topleft: 5px;
-moz-border-radius-topright: 0px;
-moz-border-radius-bottomright: 0px;
-moz-border-radius-bottomleft: 0px;
-webkit-border-radius: 5px 0px 0px 0px;
border-radius: 5px 0px 0px 0px;
}
.top-right-round{
-moz-border-radius-topleft: 0px;
-moz-border-radius-topright: 5px;
-moz-border-radius-bottomright: 0px;
-moz-border-radius-bottomleft: 0px;
-webkit-border-radius: 0px 5px 0px 0px;
border-radius: 0px 5px 0px 0px;
}
table thead th{
background: url(../images/table-header-bg.png) repeat-x;
height: 42px;
line-height: 40px;
border: 0px solid transparent;
font-weight:normal;
}
th.action_header span {
margin-right:50px;
}
th.action_header {
width: 120px;
text-align: left;
padding-left: 20px
}
th.action_header_short{
padding-left: 20px;
}
th a.sortable,th.action_header span,th.action_header_short span {
color: #fff;
font-size: 15px;
font-weight: normal;
text-decoration: none;
}
th a.sortable{
padding: 0 15px;
background: url(../images/icons/arrow_dwn.png) right center no-repeat;
}
th.sortable span{
background: url(../images/cols-seperator.png) right top no-repeat;
float:right;
margin-right: -2px;
width:5px;
height: 42px;
}
th a:hover{
color: #fff;
}
tbody td{
padding: 0 5px;
}
td.action{
width:74px;
padding: 2px;
}
.tableWrapper{
border-bottom: 1px solid #E5E5E5;
padding-bottom: 8px;
}
Style this with CSS instead of an image. You're always going to have issues using an image like this.
Related
I just can't figure how to align the text in the header on the left together with the text in body header. The table is a scrollable table.
.container {
padding-left:260px;
table-layout: fixed;
text-align: left;
}
.tableheader{
background-color: rgba(255, 255, 255, 0.3);
width: 1000px;
}
.tablecontent{
height: 100px;
width: 1000px;
overflow-x: auto;
margin-top: 0px;
border: 1px solid rgba(255,255,255,0.3);
}
th{
font-weight: 500;
font-size: 12px;
color: rgb(68, 68, 68);
text-transform: uppercase;
padding: 20px;
width: 100px;
}
td{
padding: 15px;
width: 100px;
vertical-align:middle;
font-weight: 300;
font-size: 12px;
color: rgb(59, 59, 59);
border-bottom: solid 1px rgba(255,255,255,0.1);
}
::-webkit-scrollbar {
width: 6px;
}
::-webkit-scrollbar-track {
-webkit-box-shadow: inset 0 0 6px rgba(0,0,0,0.3);
}
::-webkit-scrollbar-thumb {
-webkit-box-shadow: inset 0 0 6px rgba(0,0,0,0.3);
}
<section class="container">
<div class="tableheader" >
<table cellpadding="0" cellspacing="0" border="0">
<thead>
<tr>
<th>Username</th>
<th>Name</th>
<th>Position</th>
<th>Status</th>
<th>Time</th>
<th>Date</th>
</tr>
</thead>
</table>
</div>
<div class="tablecontent">
<table cellpadding="0" cellspacing="0" border="0">
<tbody class="tablecontent">
<?php echo $stafftable?>
</tbody>
</table>
</div>
</section>
As you can see the table header text alignment is different from table body alignment. I can't seem to find what is the problem. I have tried editing the padding and the width of th and tr.
It is beacause you have set the different padding of th and td.
try this:
.container {
padding-left:260px;
table-layout: fixed;
text-align: left;
}
.tableheader{
background-color: rgba(255, 255, 255, 0.3);
width: 1000px;
}
.tablecontent{
height: 100px;
width: 1000px;
overflow-x: auto;
margin-top: 0px;
border: 1px solid rgba(255,255,255,0.3);
}
th{
font-weight: 500;
font-size: 12px;
color: rgb(68, 68, 68);
text-transform: uppercase;
padding: 15px;
width: 100px;
}
td{
padding: 15px;
width: 100px;
vertical-align:middle;
font-weight: 300;
font-size: 12px;
color: rgb(59, 59, 59);
border-bottom: solid 1px rgba(255,255,255,0.1);
}
::-webkit-scrollbar {
width: 6px;
}
::-webkit-scrollbar-track {
-webkit-box-shadow: inset 0 0 6px rgba(0,0,0,0.3);
}
::-webkit-scrollbar-thumb {
-webkit-box-shadow: inset 0 0 6px rgba(0,0,0,0.3);
<section class="container">
<div class="tableheader" >
<table cellpadding="0" cellspacing="0" border="0">
<thead>
<tr>
<th align="left">Username</th>
<th>Name</th>
<th>Position</th>
<th>Status</th>
<th>Time</th>
<th>Date</th>
</tr>
</thead>
</table>
</div>
<div class="tablecontent">
<table cellpadding="0" cellspacing="0" border="0">
<tbody class="tablecontent">
<tr>
<td>Username</td>
<td>Name</td>
<td>Position</td>
<td>Status</td>
<td>Time</td>
<td>Date</td>
</tr>
</tbody>
</table>
</div>
</section>
Adjust your td padding property to match this of the th. In your example, td had padding 15px and th had 20px. It's responsible for the left indentation, so adjust it to be the same. In my example below it is set to 20px. Consider doing it in one place, like
td, th { padding: 20px; }
Working example:
.container {
padding-left:260px;
table-layout: fixed;
text-align: left;
}
.tableheader{
background-color: rgba(255, 255, 255, 0.3);
width: 1000px;
}
.tablecontent{
height: 100px;
width: 1000px;
overflow-x: auto;
margin-top: 0px;
border: 1px solid rgba(255,255,255,0.3);
}
th{
font-weight: 500;
font-size: 12px;
color: rgb(68, 68, 68);
text-transform: uppercase;
padding: 20px;
width: 100px;
}
td{
padding: 20px; /* CHANGED FROM 15PX TO 20PX */
width: 100px;
vertical-align:middle;
font-weight: 300;
font-size: 12px;
color: rgb(59, 59, 59);
border-bottom: solid 1px rgba(255,255,255,0.1);
}
::-webkit-scrollbar {
width: 6px;
}
::-webkit-scrollbar-track {
-webkit-box-shadow: inset 0 0 6px rgba(0,0,0,0.3);
}
::-webkit-scrollbar-thumb {
-webkit-box-shadow: inset 0 0 6px rgba(0,0,0,0.3);
}
<section class="container">
<div class="tableheader" >
<table cellpadding="0" cellspacing="0" border="0">
<thead>
<tr>
<th>Username</th>
<th>Name</th>
<th>Position</th>
<th>Status</th>
<th>Time</th>
<th>Date</th>
</tr>
</thead>
</table>
</div>
<div class="tablecontent">
<table cellpadding="0" cellspacing="0" border="0">
<tbody class="tablecontent">
<tr>
<td>Username</td>
<td>Name</td>
<td>Position</td>
<td>Status</td>
<td>Time</td>
<td>Date</td>
</tr>
<tr>
<td>Username</td>
<td>Name</td>
<td>Position</td>
<td>Status</td>
<td>Time</td>
<td>Date</td>
</tr>
<tr>
<td>Username</td>
<td>Name</td>
<td>Position</td>
<td>Status</td>
<td>Time</td>
<td>Date</td>
</tr>
<tr>
<td>Username</td>
<td>Name</td>
<td>Position</td>
<td>Status</td>
<td>Time</td>
<td>Date</td>
</tr>
</tbody>
</table>
</div>
</section>
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;
}
I need a row should be of rounded corners and a spacing between row-row.So,far I tried table table-curved class as below.
Any suggestions/modifications would be helpful.
My CSS -
.table-curved {
border-collapse: separate;
}
.table-curved {
border: solid #ccc 1px;
border-radius: 6px;
border-left:0px;
}
.table-curved tr {
border-left: 1px solid #ccc;
border-top: 1px solid #ccc;
border-radius: 26px;
border-collapse:seperate;
border-spacing:5em;
}
.table-curved th {
border-top: none;
}
.table-curved th:first-child {
border-radius: 6px 0 0 0;
}
.table-curved th:last-child {
border-radius: 0 6px 0 0;
}
.table-curved th:only-child{
border-radius: 6px 6px 0 0;
}
.table-curved tr:last-child td:first-child {
border-radius: 0 0 0 6px;
}
.table-curved tr:last-child td:last-child {
border-radius: 0 0 6px 0;
}
My HTML -
<table class="table table-curved">
<thead>
<tr>
<th>Schedule Time</th>
<th>First Name</th>
<th>Last Name</th>
<th>Telephone</th>
<th>Status</th>
<th>Contact Score</th>
<th>Last Contacted</th>
<th>Device Type</th>
</tr>
</thead>
<tbody>
<tr>
<td></td>
<td></td>
<td></td>
<td></td>
<td></td>
<td></td>
<td></td>
<td></td>
</tr>
</tbody>
</table>
To be more specific I need a row looks similar to image here
you can use :before in first column:
Here i created a example for you:
.table-curved {
border-collapse: separate;
width:100%;
border-spacing:0px;
}
.table-curved {
border: solid #ccc 1px;
border-radius: 6px;
border-left:0px;
}
.table-curved tr {
position: relative;
border-radius: 26px;
border-collapse:seperate;
border-spacing:0;
background:#f8f8f8;
backgrnoud-position-x: 10px;
padding:10px 0;
transition:background .1s;
}
.table-curved tr:hover {
background:#eee;
}
.table-curved th {
border-top: none;
}
.table-curved th:first-child {
border-radius: 6px 0 0 0;
}
.table-curved th:last-child {
border-radius: 0 6px 0 0;
}
.table-curved th:only-child{
border-radius: 6px 6px 0 0;
}
.table-curved tr:last-child td:first-child {
border-radius: 0 0 0 6px;
}
.table-curved tr:last-child td:last-child {
border-radius: 0 0 6px 0;
}
.table-curved td:first-child:before {
content: "";
display: block;
width: 10px;
height: 100%;
left: 0;
top: 0;
border-radius: 6px 0 0 6px;
position: absolute;
}
.table-curved td.red:before {
background:red;
}
.table-curved td.green:before {
background:green;
}
.table-curved td.blue:before {
background:blue;
}
.table-curved td.orange:before {
background:orange;
}
.table-curved td:first-child{
padding-left: 15px;
}
.table-curved td{
position: relative;
border-bottom: 10px solid white;
border-spacing: 0px;
padding: 10px;
}
You can try border-radius on td and th. Check below example to get started.
Adjust the border-radius as required.
Add class to tr to have desired background-color
Approach 1: A solution using pseudo element :before
.table-curved {
border-collapse: collapse;
margin-left: 10px;
}
.table-curved th {
padding: 3px 10px;
}
.table-curved td {
position: relative;
background-color: #e5e5e5;
padding: 6px 10px;
border-bottom: 2px solid white;
border-top: 2px solid white;
}
.table-curved td:first-child:before {
content: '';
position: absolute;
border-radius: 8px 0 0 8px;
background-color: coral;
width: 12px;
height: 100%;
left: -12px;
top: 0px;
}
.table-curved td:last-child {
border-radius: 0 5px 5px 0;
}
.table-curved tr:hover td {
background-color: #c5c5c5;
}
.table-curved tr.blue td:first-child:before {
background-color: cornflowerblue;
}
.table-curved tr.green td:first-child:before {
background-color: forestgreen;
}
<table class="table table-curved">
<thead>
<tr>
<th>Schedule Time</th>
<th>First Name</th>
<th>Last Name</th>
<th>Telephone</th>
<th>Status</th>
<th>Contact Score</th>
<th>Last Contacted</th>
<th>Device Type</th>
</tr>
</thead>
<tbody>
<tr class="green">
<td>.</td>
<td>.</td>
<td>.</td>
<td>.</td>
<td>.</td>
<td>.</td>
<td>.</td>
<td>.</td>
</tr>
<tr>
<td>.</td>
<td>.</td>
<td>.</td>
<td>.</td>
<td>.</td>
<td>.</td>
<td>.</td>
<td>.</td>
</tr>
<tr class="blue">
<td>.</td>
<td>.</td>
<td>.</td>
<td>.</td>
<td>.</td>
<td>.</td>
<td>.</td>
<td>.</td>
</tr>
</tbody>
</table>
Approach 2: A solution with adding extra/empty cell in each row.
.table-curved {
border-collapse: collapse;
}
.table-curved th {
padding: 3px 10px;
}
.table-curved th:first-child {
padding: 6px;
}
.table-curved td {
background-color: #e5e5e5;
padding: 6px 10px;
border-bottom: 2px solid white;
border-top: 2px solid white;
}
.table-curved td:first-child {
padding: 6px;
border-radius: 8px 0 0 8px;
background-color: coral;
}
.table-curved td:last-child {
border-radius: 0 5px 5px 0;
}
.table-curved tr:hover td:not(:first-child) {
background-color: #c5c5c5;
}
.table-curved tr.blue td:first-child {
background-color: cornflowerblue;
}
.table-curved tr.green td:first-child {
background-color: forestgreen;
}
<table class="table table-curved">
<tr>
<th></th>
<th>S.No</th>
<th>Title</th>
<th>Cost</th>
</tr>
<tr class="blue">
<td></td>
<td>1</td>
<td>Title one</td>
<td>$18.0</td>
</tr>
<tr>
<td></td>
<td>2</td>
<td>Title two</td>
<td>$23.4</td>
</tr>
<tr class="green">
<td></td>
<td>3</td>
<td>Title three</td>
<td>$40.5</td>
</tr>
</table>
You cannot apply border radius to table row, instead you can add border-radius to TD, here is example
'http://jsfiddle.net/theazureshadow/LRKXD/1/'
I have the following HTML & CSS
HTML
<table class="StandardTable">
<thead>
<tr>
<th>A</th>
<th>B</th>
<th>C</th>
<th>D</th>
</tr>
</thead>
<tbody>
<tr>
<td style="width: 25%">A</td>
<td style="width: 25%">B</td>
<td style="width: 25%">C</td>
<td style="width: 25%">D</td>
</tr>
</tbody>
</table>
CSS
.StandardTable {
border: 1px solid #656565;
border-radius: 10px;
-moz-border-radius: 10px;
margin-left: auto;
margin-right: auto;
box-shadow: 10px 10px 5px #888888;
width: 300px;
margin-bottom: 15px;
border-spacing: 0;
}
.StandardTable thead {
border-radius: 10px;
-moz-border-radius: 10px;
border-radius: 5px;
background-color: lightgray;
}
I have created the jsFiddle for this too. The background in the THEAD always bleeds / runs out of the border and does not round.
I tested in IE, FF, and chrome. It is most apparent in chrome because the bleed happens above the border where in IE and FF the bleed happens under.
Any help in fixing the issue (make the background stop correctly around the edges), is greatly appreciated. I did try to add Border-Radius on TH element, but that did not work.
You need to apply the rounded corners to the first and last table cell in the thead. Set the background for thead to transparent, and add this:
.StandardTable thead th{
background: lightgray;
}
.StandardTable thead th:first-of-type{
border-top-left-radius: 10px;
}
.StandardTable thead th:last-of-type{
border-top-right-radius: 10px;
}
Demo JsFiddle
try this (worked for me in FF)
.StandardTable {
border: 1px solid #656565;
border-radius: 10px;
-moz-border-radius: 10px;
margin-left: auto;
margin-right: auto;
box-shadow: 10px 10px 5px #888888;
width: 300px;
margin-bottom: 15px;
border-spacing: 0;
}
.StandardTable thead tr th {
background-color: lightgray;
}
.StandardTable thead tr th:first-child {
z-index:-1;
border-radius: 10px 0 0 0;
-moz-border-radius: 10px 0 0 0;
border-radius: 10px 0 0 0;
}
.StandardTable thead tr th:last-child {
z-index:-1;
border-radius: 0 10px 0 0;
-moz-border-radius: 0 10px 0 0;
border-radius: 0 10px 0 0;
}
Another workaround is to do the following
.StandardTable {
border: 1px solid #656565;
border-radius: 10px;
-moz-border-radius: 10px;
margin-left: auto;
margin-right: auto;
box-shadow: 10px 10px 5px #888888;
width: 300px;
margin-bottom: 15px;
border-spacing: 0;
background-color: lightgray;
}
.StandardTable tbody tr td {
background-color: white;
}
.StandardTable tbody tr:last-child td:last-child {
border-bottom-right-radius: 10px;
}
.StandardTable tbody tr:last-child td:first-child {
border-bottom-left-radius: 10px;
}
I can't find a matching answer for that.
HTML:
<table class="table1">
<tr>
<td class="red header" colspan="4">
Table1 header</td>
</tr>
...
<tr>
<td class="red footer" colspan="4">Footer</td>
</tr>
</table>
<table class="table2">
<tr>
<td class="red header" colspan="4">
Table2 header</td>
</tr>
...
<tr>
<td class="red footer" colspan="4">Footer</td>
</tr>
</table>
CSS:
table {
-moz-border-radius: 5px;
-webkit-border-radius: 5px;
border-radius: 5px;
border: 1px solid #000;
}
.table1 {
border-spacing: 0;
}
.table2 {
border-collapse: collapse;
}
.footer {
-moz-border-bottom-right-radius: 5px;
-webkit-border-bottom-right-radius: 5px;
border-bottom-right-radius: 5px;
-moz-border-bottom-left-radius: 5px;
-webkit-border-bottom-left-radius: 5px;
border-bottom-left-radius: 5px;
}
.header {
-moz-border-top-right-radius: 5px;
-webkit-border-top-right-radius: 5px;
border-bottom-top-radius: 5px;
-moz-border-top-left-radius: 5px;
-webkit-border-top-left-radius: 5px;
border-top-left-radius: 5px;
text-align: center;
}
td {
border: 1px solid #000;
}
http://jsfiddle.net/uXUnm/
As you can see, table1 has 2px border (I'd like 1px), table2 doesn't have rounded borders. border-collapse:collapse; fixes the first issue caused by border-spacing: 0; but breaks the roundings. Can anyone tell me a way to fix both issues without messing with :first-child, last-child etc. selectors?
here is my fixed css:
table {
border:1px solid black;
border-radius: 5px;
border-spacing: 0;
}
table td:first-child, table td:not(:first-child):not(:last-child){
border-right:1px solid black;
}
table tr:first-child td, table tr:not(:last-child) td {
border-bottom:1px solid black;
}
table thead tr:first-child td:first-child {
-webkit-border-top-left-radius: 2px;
-moz-border-radius-topleft: 2px;
border-top-left-radius: 2px;
}
table thead tr:first-child td:last-child {
-webkit-border-top-right-radius:2px;
-moz-border-radius-topright: 2px;
border-top-right-radius: 2px;
}
table tbody tr:last-child td:first-child {
-webkit-border-bottom-left-radius: 2px;
-moz-border-radius-bottomleft: 2px;
border-bottom-left-radius: 2px;
}
table tbody tr:last-child td:last-child {
-webkit-border-bottom-right-radius: 2px;
-moz-border-radius-bottomright: 2px;
border-bottom-right-radius: 2px;
}
you can set border-radius: 5px; any value and it will work perfectly!