Is it posible to do a full pagination table without javascript or jquery?
Actually i have this table:
<div class="datagrid">
<table>
<thead>
<tr><th>Header</th><th>Header</th><th>Header</th><th>Header</th><th>Header</th><th>Header</th><th>Header</th><th>Header</th><th>Header</th><th>Header</th></tr>
</thead>
<tfoot>
<tr>
<td colspan="10">
<div id="paging">
<ul>
<li><span>Previous</span></li>
<li><span>1</span></li>
<li><span>2</span></li>
<li><span>3</span></li>
<li><span>4</span></li>
<li><span>5</span></li>
<li><span>Next</span></li>
</ul>
</div>
</tr>
</tfoot>
<tbody>
<tr>
<td>data</td><td>data</td><td>data</td><td>data</td><td>data</td><td>data</td><td>data</td><td>data</td><td>data</td><td>data</td>
</tr>
<tr class="alt">
<td>data</td><td>data</td><td>data</td><td>data</td><td>data</td><td>data</td><td>data</td><td>data</td><td>data</td><td>data</td>
</tr>
<tr>
<td>data</td><td>data</td><td>data</td><td>data</td><td>data</td><td>data</td><td>data</td><td>data</td><td>data</td><td>data</td>
</tr>
<tr class="alt">
<td>data</td><td>data</td><td>data</td><td>data</td><td>data</td><td>data</td><td>data</td><td>data</td><td>data</td><td>data</td>
</tr>
<tr>
<td>data</td><td>data</td><td>data</td><td>data</td><td>data</td><td>data</td><td>data</td><td>data</td><td>data</td><td>data</td>
</tr>
<tr class="alt">
<td>data</td><td>data</td><td>data</td><td>data</td><td>data</td><td>data</td><td>data</td><td>data</td><td>data</td><td>data</td>
</tr>
<tr>
<td>data</td><td>data</td><td>data</td><td>data</td><td>data</td><td>data</td><td>data</td><td>data</td><td>data</td><td>data</td>
</tr>
<tr class="alt">
<td>data</td><td>data</td><td>data</td><td>data</td><td>data</td><td>data</td><td>data</td><td>data</td><td>data</td><td>data</td>
</tr>
<tr>
<td>data</td><td>data</td><td>data</td><td>data</td><td>data</td><td>data</td><td>data</td><td>data</td><td>data</td><td>data</td>
</tr>
<tr class="alt">
<td>data</td><td>data</td><td>data</td><td>data</td><td>data</td><td>data</td><td>data</td><td>data</td><td>data</td><td>data</td>
</tr>
</tbody>
</table>
</div>
With this CSS which was made with a random generator:
.datagrid table { border-collapse: collapse; text-align: left; width: 100%; }
.datagrid {font: normal 12px/150% Arial, Helvetica, sans-serif; background: #fff; overflow: hidden; border: 1px solid #000000; -webkit-border-radius: 11px; -moz-border-radius: 11px; border-radius: 11px; }
.datagrid table td,
.datagrid table th { padding: 7px 9px; }
.datagrid table thead th {background:-webkit-gradient( linear, left top, left bottom, color-stop(0.05, #808080), color-stop(1, #080808) );background:-moz-linear-gradient( center top, #808080 5%, #080808 100% );filter:progid:DXImageTransform.Microsoft.gradient(startColorstr='#808080', endColorstr='#080808');background-color:#808080; color:#00C2D0; font-size: 13px; font-weight: bold; border-left: 1px solid #000000; }
.datagrid table thead th:first-child { border: none; }
.datagrid table tbody td { color: #00496B; border-left: 1px solid #000000;font-size: 13px;font-weight: normal; }
.datagrid table tbody .alt td { background: #E0E0E0; color: #000000; }
.datagrid table tbody tr:hover td{color: #339; background: #ABECF0;}
.datagrid table tbody td:first-child { border-left: none; }
.datagrid table tbody tr:last-child td { border-bottom: none; }
.datagrid table tfoot td div { border-top: 1px solid #000000;background: #646464;}
.datagrid table tfoot td { padding: 0; font-size: 15px }
.datagrid table tfoot td div{ padding: 6px; }
.datagrid table tfoot td ul { margin: 0; padding:0; list-style: none; text-align: right; }
.datagrid table tfoot li { display: inline; }
.datagrid table tfoot li a { text-decoration: none; display: inline-block; padding: 2px 8px; margin: 1px;color: #00C2D0;border: 1px solid #006699;-webkit-border-radius: 7px; -moz-border-radius: 7px; border-radius: 7px; background:-webkit-gradient( linear, left top, left bottom, color-stop(0.05, #808080), color-stop(1, #080808) );background:-moz-linear-gradient( center top, #808080 5%, #080808 100% );filter:progid:DXImageTransform.Microsoft.gradient(startColorstr='#808080', endColorstr='#080808');background-color:#808080; }
.datagrid table tfoot ul.active, /* Probably here is the magic */
.datagrid table tfoot ul a:hover { text-decoration: none;border-color: #00C2D0; color: #FFFFFF; background: none; background-color:#000000;}
Question
How can i make it work to show just 5 rows with css?
Thanks in Advance
You can use like this
tr:nth-child(5) ~ tr{
display: none;
}
demo
Related
In ArcGIS Online (browser map), I have been pasting HTML and CSS code into several different plotted points. The goal is to have a styled table pop up in the dialog box/small window when the point is clicked on. At first, the table looks and functions properly, however; after saving the layer, removing it, then reloading it, all you see is the raw CSS code and a table with zero styling.
After reviewing the ArcGIS supported HTML help page, I noticed that the online browser version does not support the "style" tag (external, internal, and inline), and it gets filtered out of the code. This is what caused my table to show raw code after reloading it.
The options they list are "div" and "span," but I cannot seem to get these to work properly. Is there a way to make this work the way that I intend it to?
ArcGIS Online Supported HTML Page
Actual full code below:
<style type="text/css"> (this style tag doesn't work and is automatically filtered out)
.datagrid table {
border-collapse: collapse;
text-align: left;
width: 1280px;
}
.datagrid {
font: normal 12px/150% Arial, Helvetica, sans-serif;
background: #fff;
overflow: hidden;
border: 1px solid #006699;
-webkit-border-radius: 3px;
-moz-border-radius: 3px;
border-radius: 3px;
}
.datagrid table td,
.datagrid table th {
padding: 12px 10px;
}
.datagrid table thead th {
background: -webkit-gradient( linear, left top, left bottom, color-stop(0.05, #006699), color-stop(1, #4D1A75));
background: -moz-linear-gradient( center top, #006699 5%, #4D1A75 100%);
filter: progid: DXImageTransform.Microsoft.gradient(startColorstr='#006699', endColorstr='#4D1A75');
background-color: #006699;
color: #ffffff;
font-size: 17px;
font-weight: bold;
border-left: 1px solid #0070A8;
}
.datagrid table thead th:first-child {
border: none;
}
.datagrid table thead th:nth-child(1) {
border: none;
background: -webkit-gradient( linear, left top, left bottom, color-stop(0.05, #9643D6), color-stop(1, #4D1A75));
background: -moz-linear-gradient( center top, #9643D6 5%, #4D1A75 100%);
background-color: #9643D6;
}
.datagrid table thead th:nth-child(2) {
border: none;
background: -webkit-gradient( linear, left top, left bottom, color-stop(0.05, #D05649), color-stop(1, #7A281F));
background: -moz-linear-gradient( center top, #D05649 5%, #7A281F 100%);
background-color: #D05649;
}
.datagrid table thead th:nth-child(3) {
border: none;
background: -webkit-gradient( linear, left top, left bottom, color-stop(0.05, #159D82), color-stop(1, #094338));
background: -moz-linear-gradient( center top, #159D82 5%, #094338 100%);
background-color: #159D82;
}
.datagrid table tbody td {
color: #00496B;
border-left: 1px solid #4D1A75;
font-size: 12px;
border-bottom: 1px solid #4D1A75;
font-weight: normal;
}
.datagrid table tbody .alt td {
color: #00496B;
}
.datagrid table tbody td:first-child {
border-left: none;
}
.datagrid table tbody td:nth-child(1) {
background: #F4E3FF;
}
.datagrid table tbody .alt td:nth-child(1) {
background: #FFFFFF;
}
.datagrid table tbody td:nth-child(2) {
background: #F9D9D6;
}
.datagrid table tbody .alt td:nth-child(2) {
background: #FFFFFF;
}
.datagrid table tbody td:nth-child(3) {
background: #A5F3E3;
}
.datagrid table tbody .alt td:nth-child(3) {
background: #FFFFFF;
}
.datagrid table tbody tr:last-child td {
border-bottom: none;
}
.datagrid table tfoot td div {
border-top: 1px solid #652299;
background: -webkit-gradient( linear, left top, left bottom, color-stop(0.05, #939393), color-stop(1, #FFFFFF));
background: -moz-linear-gradient( center top, #737373 5%, #FFFFFF 10%);
background-color: #737373;
}
.datagrid table tfoot td {
padding: 0;
font-size: 12px
}
.datagrid table tfoot td div {
padding: 2px;
}
.datagrid table tfoot td ul {
margin: 0;
padding: 0;
list-style: none;
text-align: right;
}
.datagrid table tfoot li {
display: inline;
}
.datagrid table tfoot li a {
text-decoration: none;
display: inline-block;
padding: 4px 8px;
margin: 1px;
color: #FFFFFF;
border: 1px solid #652299;
-webkit-border-radius: 3px;
-moz-border-radius: 3px;
border-radius: 3px;
background: -webkit-gradient( linear, left top, left bottom, color-stop(0.05, #652299), color-stop(1, #4D1A75));
background: -moz-linear-gradient( center top, #006699 5%, #4D1A75 100%);
filter: progid: DXImageTransform.Microsoft.gradient(startColorstr='#652299', endColorstr='#4D1A75');
background-color: #652299;
}
.datagrid table tfoot ul.active,
.datagrid table tfoot ul a:hover {
text-decoration: none;
border-color: #652299;
color: #FFFFFF;
background: none;
background-color: #0682B8;
</style> (this style tag doesn't work and is automatically filtered out)
<div class="datagrid">
<table style="text-align:center">
<thead>
<tr>
<th style="text-align:center">header</th>
<th style="text-align:center">header</th>
<th style="text-align:center">header</th>
</tr>
</thead>
<tfoot>
<tr>
<td colspan="3">
<div id="paging">
<ul>
<li><span>Temporary Blank</span>
</li>
<li><span>Temporary Blank</span>
</li>
<li><span>Temporary Blank</span>
</li>
</ul>
</div>
</tr>
</tfoot>
<tbody>
<tr>
<td>data</td>
<td>data</td>
<td>data</td>
</tr>
<tr class="alt">
<td>data</td>
<td>data</td>
<td>data</td>
</tr>
<tr>
<td>data</td>
<td>data</td>
<td>data</td>
</tr>
<tr class="alt">
<td>data</td>
<td>data</td>
<td>data</td>
</tr>
<tr>
<td>data</td>
<td>data</td>
<td>data</td>
</tr>
<tr class="alt">
<td>data</td>
<td>data</td>
<td>data</td>
</tr>
<tr>
<td>data</td>
<td>data</td>
<td>data</td>
</tr>
<tr class="alt">
<td>data</td>
<td>data</td>
<td>data</td>
</tr>
</tbody>
</table>
</div>
it help full
<style type="text/css">
.datagrid table {
border-collapse: collapse;
text-align: left;
width: 1280px;
}
.datagrid {
font: normal 12px/150% Arial, Helvetica, sans-serif;
background: #fff;
overflow: hidden;
border: 1px solid #006699;
-webkit-border-radius: 3px;
-moz-border-radius: 3px;
border-radius: 3px;
}
.datagrid table td,
.datagrid table th {
padding: 12px 10px;
}
.datagrid table thead th {
background: -webkit-gradient( linear, left top, left bottom, color-stop(0.05, #006699), color-stop(1, #4D1A75));
background: -moz-linear-gradient( center top, #006699 5%, #4D1A75 100%);
filter: progid: DXImageTransform.Microsoft.gradient(startColorstr='#006699', endColorstr='#4D1A75');
background-color: #006699;
color: #ffffff;
font-size: 17px;
font-weight: bold;
border-left: 1px solid #0070A8;
}
.datagrid table thead th:first-child {
border: none;
}
.datagrid table thead th:nth-child(1) {
border: none;
background: -webkit-gradient( linear, left top, left bottom, color-stop(0.05, #9643D6), color-stop(1, #4D1A75));
background: -moz-linear-gradient( center top, #9643D6 5%, #4D1A75 100%);
background-color: #9643D6;
}
.datagrid table thead th:nth-child(2) {
border: none;
background: -webkit-gradient( linear, left top, left bottom, color-stop(0.05, #D05649), color-stop(1, #7A281F));
background: -moz-linear-gradient( center top, #D05649 5%, #7A281F 100%);
background-color: #D05649;
}
.datagrid table thead th:nth-child(3) {
border: none;
background: -webkit-gradient( linear, left top, left bottom, color-stop(0.05, #159D82), color-stop(1, #094338));
background: -moz-linear-gradient( center top, #159D82 5%, #094338 100%);
background-color: #159D82;
}
.datagrid table tbody td {
color: #00496B;
border-left: 1px solid #4D1A75;
font-size: 12px;
border-bottom: 1px solid #4D1A75;
font-weight: normal;
}
.datagrid table tbody .alt td {
color: #00496B;
}
.datagrid table tbody td:first-child {
border-left: none;
}
.datagrid table tbody td:nth-child(1) {
background: #F4E3FF;
}
.datagrid table tbody .alt td:nth-child(1) {
background: #FFFFFF;
}
.datagrid table tbody td:nth-child(2) {
background: #F9D9D6;
}
.datagrid table tbody .alt td:nth-child(2) {
background: #FFFFFF;
}
.datagrid table tbody td:nth-child(3) {
background: #A5F3E3;
}
.datagrid table tbody .alt td:nth-child(3) {
background: #FFFFFF;
}
.datagrid table tbody tr:last-child td {
border-bottom: none;
}
.datagrid table tfoot td div {
border-top: 1px solid #652299;
background: -webkit-gradient( linear, left top, left bottom, color-stop(0.05, #939393), color-stop(1, #FFFFFF));
background: -moz-linear-gradient( center top, #737373 5%, #FFFFFF 10%);
background-color: #737373;
}
.datagrid table tfoot td {
padding: 0;
font-size: 12px
}
.datagrid table tfoot td div {
padding: 2px;
}
.datagrid table tfoot td ul {
margin: 0;
padding: 0;
list-style: none;
text-align: right;
}
.datagrid table tfoot li {
display: inline;
}
.datagrid table tfoot li a {
text-decoration: none;
display: inline-block;
padding: 4px 8px;
margin: 1px;
color: #FFFFFF;
border: 1px solid #652299;
-webkit-border-radius: 3px;
-moz-border-radius: 3px;
border-radius: 3px;
background: -webkit-gradient( linear, left top, left bottom, color-stop(0.05, #652299), color-stop(1, #4D1A75));
background: -moz-linear-gradient( center top, #006699 5%, #4D1A75 100%);
filter: progid: DXImageTransform.Microsoft.gradient(startColorstr='#652299', endColorstr='#4D1A75');
background-color: #652299;
}
.datagrid table tfoot ul.active,
.datagrid table tfoot ul a:hover {
text-decoration: none;
border-color: #652299;
color: #FFFFFF;
background: none;
background-color: #0682B8;
</style> (this style tag doesn't work and is automatically filtered out)
<div class="datagrid">
<table style="text-align:center">
<thead>
<tr>
<th style="text-align:center">header</th>
<th style="text-align:center">header</th>
<th style="text-align:center">header</th>
</tr>
</thead>
<tfoot>
<tr>
<td colspan="3">
<div id="paging">
<ul>
<li><span>Temporary Blank</span>
</li>
<li><span>Temporary Blank</span>
</li>
<li><span>Temporary Blank</span>
</li>
</ul>
</div>
</tr>
</tfoot>
<tbody>
<tr>
<td>data</td>
<td>data</td>
<td>data</td>
</tr>
<tr class="alt">
<td>data</td>
<td>data</td>
<td>data</td>
</tr>
<tr>
<td>data</td>
<td>data</td>
<td>data</td>
</tr>
<tr class="alt">
<td>data</td>
<td>data</td>
<td>data</td>
</tr>
<tr>
<td>data</td>
<td>data</td>
<td>data</td>
</tr>
<tr class="alt">
<td>data</td>
<td>data</td>
<td>data</td>
</tr>
<tr>
<td>data</td>
<td>data</td>
<td>data</td>
</tr>
<tr class="alt">
<td>data</td>
<td>data</td>
<td>data</td>
</tr>
</tbody>
</table>
</div>
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>
Can somebody help me to adjust the scrollbar inside the table with a fixed header?
table a:link {
color: #666;
font-weight: bold;
text-decoration:none;
}
table a:visited {
color: #999999;
font-weight:bold;
text-decoration:none;
}
table a:active,
table a:hover {
color: #bd5a35;
text-decoration:underline;
}
table {
font-family:Arial, Helvetica, sans-serif;
color:#666;
font-size:12px;
text-shadow: 1px 1px 0px #fff;
background:#eaebec;
margin:20px;
border:#ccc 1px solid;
-moz-border-radius:3px;
-webkit-border-radius:3px;
border-radius:3px;
-moz-box-shadow: 0 1px 2px #d1d1d1;
-webkit-box-shadow: 0 1px 2px #d1d1d1;
box-shadow: 0 1px 2px #d1d1d1;
}
table th {
padding:21px 25px 22px 25px;
border-top:1px solid #fafafa;
border-bottom:1px solid #e0e0e0;
background: #ededed;
background: -webkit-gradient(linear, left top, left bottom, from(#ededed), to(#ebebeb));
background: -moz-linear-gradient(top, #ededed, #ebebeb);
}
table th:first-child {
text-align: left;
padding-left:20px;
}
table tr:first-child th:first-child {
-moz-border-radius-topleft:3px;
-webkit-border-top-left-radius:3px;
border-top-left-radius:3px;
}
table tr:first-child th:last-child {
-moz-border-radius-topright:3px;
-webkit-border-top-right-radius:3px;
border-top-right-radius:3px;
}
table tr {
text-align: center;
padding-left:20px;
}
table td:first-child {
text-align: left;
padding-left:20px;
border-left: 0;
}
table td {
padding:18px;
border-top: 1px solid #ffffff;
border-bottom:1px solid #e0e0e0;
border-left: 1px solid #e0e0e0;
background: #fafafa;
background: -webkit-gradient(linear, left top, left bottom, from(#fbfbfb), to(#fafafa));
background: -moz-linear-gradient(top, #fbfbfb, #fafafa);
}
table tr.even td {
background: #f6f6f6;
background: -webkit-gradient(linear, left top, left bottom, from(#f8f8f8), to(#f6f6f6));
background: -moz-linear-gradient(top, #f8f8f8, #f6f6f6);
}
table tr:last-child td {
border-bottom:0;
}
table tr:last-child td:first-child {
-moz-border-radius-bottomleft:3px;
-webkit-border-bottom-left-radius:3px;
border-bottom-left-radius:3px;
}
table tr:last-child td:last-child {
-moz-border-radius-bottomright:3px;
-webkit-border-bottom-right-radius:3px;
border-bottom-right-radius:3px;
}
table tr:hover td {
background: #f2f2f2;
background: -webkit-gradient(linear, left top, left bottom, from(#f2f2f2), to(#f0f0f0));
background: -moz-linear-gradient(top, #f2f2f2, #f0f0f0);
}
<div class="tablecontainer">
<div class="table" >
<table cellspacing='0'>
<thead>
<tr>
<th>Tutor Name </th>
<th>Tutor NRIC</th>
<th>Tutor Email</th>
<th>Tutor qualification</th>
</tr>
</thead>
<tbody>
<tr>
<td>Jane</td>
<td>1234567</td>
<td>Jane#gmail.com</td>
<td>Diploma</td>
</tr>
<tr>
<td>John</td>
<td>1234567</td>
<td>jphn#gmail.com</td>
<td>Diploma</td>
</tr>
</tbody>
</table>
</div>
</div>
Your tbody must have a height and an overflow rule to activate the scrollbar. Meanwhile your thead must be positioned
.wrap-scroll thead {
position: absolute;
left: 0;
top: 0;
width: 100%;
}
.wrap-scroll {
height: 106px;
overflow-y: auto;
}
See my DEMO for it
I have 3 gridviews in a table, 3 < td >. I created a CSS class to change color of Gridview rows upon mouse-hover. But the problem is, the BACKGROUND OF GRIDVIEWS ALSO CHANGE COLOR. So when I hover the cursor, each row changes color but also the background (< td >, the back of the gridview also) changes color. How do I change color of my gridviews' rows only?
Code:
<style type="text/css">
.CSSTable
{
margin: 0px;
padding: 0px;
width: 60%; /*Fits the <div>*/
box-shadow: 10px 10px 5px #888888;
border: 1px solid #000000;
}
.CSSTable table
{
border-collapse: collapse;
border-spacing: 0;
width: 100%; /*sets table all aligned*/
height: 100%;
margin: 0px;
padding: 0px;
}
.CSSTable tr:last-child td:last-child
{
-moz-border-radius-bottomright: 0px;
-webkit-border-bottom-right-radius: 0px;
border-bottom-right-radius: 0px;
}
.CSSTable table tr:first-child td:first-child
{
-moz-border-radius-topleft: 0px;
-webkit-border-top-left-radius: 0px;
border-top-left-radius: 0px;
}
.CSSTable table tr:first-child td:last-child
{
-moz-border-radius-topright: 0px;
-webkit-border-top-right-radius: 0px;
border-top-right-radius: 0px;
}
.CSSTable tr:last-child td:first-child
{
-moz-border-radius-bottomleft: 0px;
-webkit-border-bottom-left-radius: 0px;
border-bottom-left-radius: 0px;
}
.CSSTable tr:hover td
{
}
.CSSTable tr:nth-child(odd)
{
background-color: #e5e5e5;
}
.CSSTable tr:nth-child(even)
{
background-color: #ffffff;
}
.CSSTable td
{
vertical-align: middle;
border: 1px solid #000000;
border-width: 0px 1px 1px 0px;
text-align: left;
padding: 7px;
font-size: 11px;
font-family: Arial;
font-weight: normal;
color: #000000;
}
.CSSTable tr:last-child td
{
border-width: 0px 1px 0px 0px;
}
.CSSTable tr td:last-child
{
border-width: 0px 0px 1px 0px;
}
.CSSTable tr:last-child td:last-child
{
border-width: 0px 0px 0px 0px;
}
.CSSTable tr:first-child td
{
background: -o-linear-gradient(bottom, #4c4c4c 5%, #000000 100%);
background: -webkit-gradient( linear, left top, left bottom, color-stop(0.05, #4c4c4c), color-stop(1, #000000) );
background: -moz-linear-gradient( center top, #4c4c4c 5%, #000000 100% );
filter: progid:DXImageTransform.Microsoft.gradient(startColorstr="#4c4c4c", endColorstr="#000000");
background: -o-linear-gradient(top,#4c4c4c,000000);
background-color: #4c4c4c;
border: 0px solid #000000;
text-align: center;
border-width: 0px 0px 1px 1px;
font-size: 10px;
font-family: Verdana;
font-weight: bold;
color: #ffffff;
}
.CSSTable tr:first-child:hover td
{
background: -o-linear-gradient(bottom, #4c4c4c 5%, #000000 100%);
background: -webkit-gradient( linear, left top, left bottom, color-stop(0.05, #4c4c4c), color-stop(1, #000000) );
background: -moz-linear-gradient( center top, #4c4c4c 5%, #000000 100% );
filter: progid:DXImageTransform.Microsoft.gradient(startColorstr="#4c4c4c", endColorstr="#000000");
background: -o-linear-gradient(top,#4c4c4c,000000);
background-color: #4c4c4c;
}
.CSSTable tr:first-child td:first-child
{
border-width: 0px 0px 1px 0px;
}
.CSSTable tr:first-child td:last-child
{
border-width: 0px 0px 1px 1px;
}
.CSSTable tr:hover
{
background-color:Gray;
}
</style>
Well, since you haven't posted the pertinent html markup related to the this question I'm going to guess you have added the CSSTable class to your wrapper table? For example, if you have this html hierarchy...
<table class="CSSTable">
<tr>
<td><asp:GridView>...</asp:GridView></td>
</tr>
<tr>
<td><asp:GridView>...</asp:GridView></td>
</tr>
<tr>
<td><asp:GridView>...</asp:GridView></td>
</tr>
</table>
you should change it to...
<table>
<tr>
<td><asp:GridView CssClass="CSSTable">...</asp:GridView></td>
</tr>
<tr>
<td><asp:GridView CssClass="CSSTable">...</asp:GridView></td>
</tr>
<tr>
<td><asp:GridView CssClass="CSSTable">...</asp:GridView></td>
</tr>
</table>
or if you are only targeting the row hover just create a css class to handle the hover event and then set the CssClass property of the RowStyle element...
<asp:GridView>
<RowStyle CssClass="" />
</asp:GridView>
I'm trying to create a datagrid and stumbled on two problems.
I had to use border-collapse: separate; to get round corners on top.
But by doing that I lost the ability to add borders on tr botton.
Any insights?
http://fiddle.jshell.net/KNb7K/
css:
table.dgrid {
border: solid 1px #CDCDCD;
.border-radius(8px, 0px, 0px, 8px);
width: 100%;
border-collapse: separate;
}
table.dgrid th:first-child{
.border-radius(0px, 0px, 0px, 8px);
}
table.dgrid th:last-child{
.border-radius(8px, 0px, 0px, 0px);
}
table.dgrid th{
background-color: #E6E6E6;
}
table.dgrid tr th:last-child, table.dgrid tr td:last-child{
border-right: 0px;
}
table.dgrid tbody tr:last-child {
border-bottom: 0;
}
table.dgrid tr {
border-bottom: solid 1px #CDCDCD;
border-collapse: collapse ;
}
table.dgrid th, table.dgrid td {
padding: 5px;
text-align: center;
vertical-align: middle;
border-right: solid 1px #CDCDCD;
}
html:
<table class="dgrid">
<thead>
<tr>
<th>Ativar</th>
<th>Imagem</th>
<th>Posição</th>
<th>Link</th>
<th>Excluir</th>
</tr>
</thead>
<tbody>
<tr>
<td><input type="checkbox" /></td>
<td></td>
<td></td>
<td><input type="text" /></td>
<td></td>
</tr>
<tr>
<td><input type="checkbox" /></td>
<td></td>
<td></td>
<td><input type="text" /></td>
<td></td>
</tr>
<tr>
<td><input type="checkbox" /></td>
<td></td>
<td></td>
<td><input type="text" /></td>
<td></td>
</tr>
</tbody>
</table>
You can put the bottom-border on table.dgrid th, table.dgrid td and then I would update the table.dgrid tbody tr:last-child to have the td in there like so: table.dgrid tbody tr:last-child td.
Remove border-collapse: separate; from table.dgrid.
this works:
table.dgrid {
width: 98%;
border-collapse: separate;
border-bottom: solid 1px #CDCDCD;
margin:1%;
}
table.dgrid th:first-child{
border-top-left-radius: 8px;
}
table.dgrid th:first-child, table.dgrid td:first-child{
border-left: solid 1px #CDCDCD;
}
table.dgrid th:last-child{
border-top-right-radius: 8px;
}
table.dgrid th{
background-color: #E6E6E6;
}
table.dgrid tbody tr:last-child {
border-bottom: 0;
}
table.dgrid th, table.dgrid td {
padding: 5px;
text-align: center;
vertical-align: middle;
border-top: solid 1px #CDCDCD;
border-right: solid 1px #CDCDCD;
}