trying to put scrollbar to my table i put it but its very far away from table. how can i put it near the table
.html
<h1> ASSET TABLE </h1>
<div class="table">
<div class = "overflow-auto">
{% render_table table_assets %}
</div>
</div>
<h1>TASK TABLE </h1>
<div class="table">
{% render_table table_tasks %}
</div>
.css
.overflow-auto {
height: 150px;
overflow-y: scroll;
overflow: auto;
}
it seems like that
You have to set a width for the parent div.
A block-level element always starts on a new line and takes up the full width available (stretches out to the left and right as far as it can).
Block-level elements
#container {
overflow-y: scroll;
max-width: 500px;
max-height: 200px;
}
table {
width: 100%;
}
<div id='container'>
<table>
<thead>
<tr>
<th>A</th>
<th>B</th>
<th>C</th>
</tr>
</thead>
<tbody>
<tr>
<td>1</td>
<td>2</td>
<td>3</td>
</tr>
<tr>
<td>4</td>
<td>5</td>
<td>6</td>
</tr>
<tr>
<td>7</td>
<td>8</td>
<td>9</td>
</tr>
<tr>
<td>1</td>
<td>2</td>
<td>3</td>
</tr>
<tr>
<td>4</td>
<td>5</td>
<td>6</td>
</tr>
<tr>
<td>7</td>
<td>8</td>
<td>9</td>
</tr>
<tr>
<td>1</td>
<td>2</td>
<td>3</td>
</tr>
<tr>
<td>4</td>
<td>5</td>
<td>6</td>
</tr>
<tr>
<td>7</td>
<td>8</td>
<td>9</td>
</tr>
<tr>
<td>1</td>
<td>2</td>
<td>3</td>
</tr>
<tr>
<td>4</td>
<td>5</td>
<td>6</td>
</tr>
<tr>
<td>7</td>
<td>8</td>
<td>9</td>
</tr>
<tr>
<td>1</td>
<td>2</td>
<td>3</td>
</tr>
<tr>
<td>4</td>
<td>5</td>
<td>6</td>
</tr>
<tr>
<td>7</td>
<td>8</td>
<td>9</td>
</tr>
<tr>
<td>1</td>
<td>2</td>
<td>3</td>
</tr>
<tr>
<td>4</td>
<td>5</td>
<td>6</td>
</tr>
<tr>
<td>7</td>
<td>8</td>
<td>9</td>
</tr>
</tbody>
</table>
</div>
Related
I followed a CSS Tricks tutorial to get a table with a sticky header and first column, and tried adding a Bootstrap dropdown inside of the first column.
Problem is, the dropdown shows up in front of the parent cell but behind all of the others of the first column:
I've tried changing the position of the cell to relative, switching the z-index of the dropdown menu to a higher value but the dropdown is still behind the first column.
Here's a JSFiddle with a minimum, reproducible example: https://jsfiddle.net/maxencelav/hwsrcmL6/14/
#import url("https://fonts.googleapis.com/css2?family=Fraunces:ital,wght#0,700;1,200&display=swap");
table {
font-family: "Fraunces", serif;
font-size: 125%;
white-space: nowrap;
margin: 3px;
border: none;
border-collapse: separate;
border-spacing: 0;
table-layout: fixed;
border: 1px solid black;
}
table td,
table th {
border: 1px solid black;
padding: 0.5rem 1rem;
}
table thead th {
padding: 3px;
position: sticky;
top: 0;
z-index: 1;
width: 25vw;
background: white;
}
table td {
background: #fff;
padding: 4px 5px;
text-align: center;
}
table tbody th {
font-weight: 100;
font-style: italic;
text-align: left;
position: relative;
}
table thead th:first-child {
position: sticky;
left: 0;
z-index: 2;
}
table tbody th {
position: sticky;
left: 0;
background: white;
z-index: 1;
}
caption {
text-align: left;
padding: 0.25rem;
position: sticky;
left: 0;
}
[role="region"][aria-labelledby][tabindex] {
width: 100%;
max-height: 98vh;
overflow: auto;
}
#team-cell-container {
display: grid;
grid-template-columns: 1fr auto;
align-items: center;
margin: 0;
gap: 5px;
}
<script src="https://code.jquery.com/jquery-3.4.1.slim.js"></script>
<link href="https://stackpath.bootstrapcdn.com/bootstrap/4.4.1/css/bootstrap.css" rel="stylesheet" />
<script src="https://cdnjs.cloudflare.com/ajax/libs/popper.js/1.16.0/umd/popper.js"></script>
<script src="https://stackpath.bootstrapcdn.com/bootstrap/4.4.1/js/bootstrap.js"></script>
<link href="https://stackpath.bootstrapcdn.com/font-awesome/4.7.0/css/font-awesome.css" rel="stylesheet" />
<!-- Based off https://css-tricks.com/a-table-with-both-a-sticky-header-and-a-sticky-first-column/ -->
<table>
<thead>
<tr>
<th>Teams</th>
<th>1</th>
<th>2</th>
<th>3</th>
<th>4</th>
<th>5</th>
<th>6</th>
<th>7</th>
<th>8</th>
<th>9</th>
<th>Runs</th>
</tr>
</thead>
<tbody>
<tr>
<th>
<div id="team-cell-container">
Milwaukee Brewers
<div class="dropdown">
<i class="fa fa-cog" type="button" id="dropdown-item" data-toggle="dropdown" aria-haspopup="true" aria-expanded="false"></i>
<div class="dropdown-menu" aria-labelledby="dropdown-item">
<a class="dropdown-item" href="#">Action</a>
<a class="dropdown-item" href="#">Another action</a>
<a class="dropdown-item" href="#">Something else here</a>
</div>
</div>
</div>
</th>
<td>2</td>
<td>1</td>
<td>4</td>
<td>0</td>
<td>3</td>
<td>1</td>
<td>1</td>
<td>0</td>
<td>1</td>
<td>13</td>
</tr>
<tr>
<th>Los Angles Dodgers</th>
<td>4</td>
<td>2</td>
<td>0</td>
<td>0</td>
<td>3</td>
<td>2</td>
<td>4</td>
<td>2</td>
<td>3</td>
<td>20</td>
</tr>
<tr>
<th>New York Mets</th>
<td>0</td>
<td>1</td>
<td>2</td>
<td>0</td>
<td>0</td>
<td>2</td>
<td>4</td>
<td>0</td>
<td>3</td>
<td>12</td>
</tr>
<tr>
<th>St. Louis Cardinals</th>
<td>3</td>
<td>4</td>
<td>1</td>
<td>3</td>
<td>2</td>
<td>4</td>
<td>3</td>
<td>2</td>
<td>3</td>
<td>25</td>
</tr>
</tbody>
</table>
This is problem with CSS position and z-index. It was explained by this question. (Or see my testing).
To make position: absolute with high z-index appears on top of other relative, you have to set z-index of the others to be lower than z-index of the parent dropdown . This confirmed work by this answer.
First, add some identity to your table.
<!-- Based off https://css-tricks.com/a-table-with-both-a-sticky-header-and-a-sticky-first-column/ -->
<table id="my-table">
<thead>
<tr>
<th>Teams</th>
<th>1</th>
<th>2</th>
<th>3</th>
<th>4</th>
<th>5</th>
<th>6</th>
<th>7</th>
<th>8</th>
<th>9</th>
<th>Runs</th>
</tr>
</thead>
<tbody>
<tr>
<th>
<div id="team-cell-container">
Milwaukee Brewers
<div class="dropdown">
<i class="fa fa-cog" type="button" id="dropdown-item" data-toggle="dropdown" aria-haspopup="true" aria-expanded="false"></i>
<div class="dropdown-menu" aria-labelledby="dropdown-item">
<a class="dropdown-item" href="#">Action</a>
<a class="dropdown-item" href="#">Another action</a>
<a class="dropdown-item" href="#">Something else here</a>
</div>
</div>
</div>
</th>
<td>2</td>
<td>1</td>
<td>4</td>
<td>0</td>
<td>3</td>
<td>1</td>
<td>1</td>
<td>0</td>
<td>1</td>
<td>13</td>
</tr>
<tr>
<th>Los Angles Dodgers</th>
<td>4</td>
<td>2</td>
<td>0</td>
<td>0</td>
<td>3</td>
<td>2</td>
<td>4</td>
<td>2</td>
<td>3</td>
<td>20</td>
</tr>
<tr>
<th>New York Mets</th>
<td>0</td>
<td>1</td>
<td>2</td>
<td>0</td>
<td>0</td>
<td>2</td>
<td>4</td>
<td>0</td>
<td>3</td>
<td>12</td>
</tr>
<tr>
<th>St. Louis Cardinals</th>
<td>3</td>
<td>4</td>
<td>1</td>
<td>3</td>
<td>2</td>
<td>4</td>
<td>3</td>
<td>2</td>
<td>3</td>
<td>25</td>
</tr>
<tr>
<th>Houston Astros</th>
<td>3</td>
<td>2</td>
<td>1</td>
<td>4</td>
<td>2</td>
<td>3</td>
<td>1</td>
<td>3</td>
<td>1</td>
<td>20</td>
</tr>
<tr>
<th>Toronto Blue Jays</th>
<td>2</td>
<td>4</td>
<td>4</td>
<td>1</td>
<td>1</td>
<td>2</td>
<td>3</td>
<td>4</td>
<td>1</td>
<td>22</td>
</tr>
<tr>
<th>Boston Red Sox</th>
<td>4</td>
<td>4</td>
<td>4</td>
<td>0</td>
<td>3</td>
<td>0</td>
<td>0</td>
<td>1</td>
<td>1</td>
<td>17</td>
</tr>
<tr>
<th>Chicago Cubs</th>
<td>1</td>
<td>1</td>
<td>0</td>
<td>0</td>
<td>2</td>
<td>2</td>
<td>2</td>
<td>0</td>
<td>4</td>
<td>12</td>
</tr>
<tr>
<th>Philadelphia Phillies</th>
<td>0</td>
<td>4</td>
<td>2</td>
<td>0</td>
<td>4</td>
<td>1</td>
<td>0</td>
<td>4</td>
<td>2</td>
<td>17</td>
</tr>
<tr>
<th>Chicago White Sox</th>
<td>2</td>
<td>0</td>
<td>2</td>
<td>3</td>
<td>4</td>
<td>2</td>
<td>4</td>
<td>2</td>
<td>0</td>
<td>19</td>
</tr>
<tr>
<th>San Diego Padres</th>
<td>2</td>
<td>2</td>
<td>3</td>
<td>0</td>
<td>4</td>
<td>2</td>
<td>2</td>
<td>0</td>
<td>2</td>
<td>17</td>
</tr>
<tr>
<th>Cleveland Indians</th>
<td>1</td>
<td>0</td>
<td>0</td>
<td>3</td>
<td>2</td>
<td>1</td>
<td>3</td>
<td>1</td>
<td>0</td>
<td>11</td>
</tr>
<tr>
<th>San Francisco Giants</th>
<td>1</td>
<td>3</td>
<td>1</td>
<td>4</td>
<td>1</td>
<td>1</td>
<td>1</td>
<td>2</td>
<td>3</td>
<td>17</td>
</tr>
<tr>
<th>Cincinatti Reds</th>
<td>2</td>
<td>2</td>
<td>4</td>
<td>1</td>
<td>4</td>
<td>2</td>
<td>2</td>
<td>3</td>
<td>3</td>
<td>23</td>
</tr>
<tr>
<th>Minnesota Twins</th>
<td>4</td>
<td>4</td>
<td>1</td>
<td>0</td>
<td>2</td>
<td>0</td>
<td>3</td>
<td>1</td>
<td>3</td>
<td>18</td>
</tr>
<tr>
<th>Tampa Bay Rays</th>
<td>4</td>
<td>1</td>
<td>3</td>
<td>0</td>
<td>2</td>
<td>1</td>
<td>4</td>
<td>0</td>
<td>1</td>
<td>16</td>
</tr>
<tr>
<th>Miami Marlins</th>
<td>0</td>
<td>3</td>
<td>0</td>
<td>4</td>
<td>3</td>
<td>3</td>
<td>0</td>
<td>1</td>
<td>4</td>
<td>18</td>
</tr>
<tr>
<th>Oakland Athletics</th>
<td>3</td>
<td>3</td>
<td>2</td>
<td>0</td>
<td>4</td>
<td>2</td>
<td>0</td>
<td>1</td>
<td>0</td>
<td>15</td>
</tr>
<tr>
<th>Detroit Tigers</th>
<td>3</td>
<td>4</td>
<td>1</td>
<td>2</td>
<td>3</td>
<td>2</td>
<td>0</td>
<td>0</td>
<td>4</td>
<td>19</td>
</tr>
<tr>
<th>Pittsburgh Pirates</th>
<td>2</td>
<td>2</td>
<td>0</td>
<td>3</td>
<td>0</td>
<td>2</td>
<td>2</td>
<td>2</td>
<td>2</td>
<td>15</td>
</tr>
<tr>
<th>Seattle Mariners</th>
<td>1</td>
<td>3</td>
<td>3</td>
<td>1</td>
<td>2</td>
<td>2</td>
<td>0</td>
<td>4</td>
<td>0</td>
<td>16</td>
</tr>
<tr>
<th>Atlanta Braves</th>
<td>4</td>
<td>3</td>
<td>0</td>
<td>3</td>
<td>4</td>
<td>4</td>
<td>4</td>
<td>4</td>
<td>3</td>
<td>29</td>
</tr>
</tbody>
</table>
</div>
Then use Bootstrap dropdown events to listen on show or hide the dropdown element.
$('#my-table .dropdown').on('show.bs.dropdown', (event) => {
let thisTable = event.target.closest('table');
thisTable.classList.add('dropdowns-opened');
// add class to all <tr>
$(thisTable).find('tr').addClass('non-dropdown');
// remove class of this <tr>
event.target.closest('tr').classList.remove('non-dropdown');
});
$('#my-table .dropdown').on('hidden.bs.dropdown', (event) => {
let thisTable = event.target.closest('table');
thisTable.classList.remove('dropdowns-opened');
$(thisTable).find('tr').removeClass('non-dropdown');
});
The JavaScript above will add and remove class when dropdown element show or hide.
Now, add some CSS class to make dropdown appears on top of other.
table.dropdowns-opened tbody tr.non-dropdown th {
z-index: 0;
}
See it in action on JsFiddle.
You maybe change your current z-index: 1 to 2 and use the class above from z-index: 0 to 1 if the sticky functional is not work as expected.
I want to fix table thead in angular when it gets top page. When I scroll inside table scrolling thead is fixing and this situation I use sticky but when I scroll browser page it doesn't work. Bellow a image what exactly I want
enter image description here
in html
<div class="table-responsive " style="width: 100%; height: 670px;">
<!--<table class="table table-striped table-bordered">-->
<table class="table table-hover info">
<thead>
<tr style="background-color: lightskyblue;">
<th>ID</th>
<!--<th jhiTranslate="jhiApp.kassa.date_enter">DateEnter</th>-->
<th jhiTranslate="jhiApp.kassa.date_prov">DateProv</th>
<th jhiTranslate="jhiApp.kassa.date_doc">DateDoc</th>
<th jhiTranslate="jhiApp.kassa.num_doc">NumDoc</th>
<th jhiTranslate="jhiApp.kassa.acc_db">AccDb</th>
<th jhiTranslate="jhiApp.kassa.bank_db">BankDb</th>
<th jhiTranslate="jhiApp.kassa.name_db">NameDb</th>
<th jhiTranslate="jhiApp.kassa.acc_cr">AccCr</th>
<th jhiTranslate="jhiApp.kassa.bank_cr">BankCr</th>
<th jhiTranslate="jhiApp.kassa.name_cr">NameCr</th>
<th jhiTranslate="jhiApp.kassa.currency">Currency</th>
<th jhiTranslate="jhiApp.kassa.summa">Summa</th>
<th jhiTranslate="jhiApp.kassa.summa_eq">SummaEq</th>
<th jhiTranslate="jhiApp.kassa.purpose">Purpose</th>
<th jhiTranslate="jhiApp.kassa.inn_db">InnDb</th>
<th jhiTranslate="jhiApp.kassa.inn_cr">InnCr</th>
</tr>
</thead>
<tbody *ngFor="let array of kassas">
</tbody>
</table>
</div>
in css
thead th {
position: sticky;
top: 0;
background-color: lightskyblue;
}
Maybe this code be usefull
thead th{
background-color: lightskyblue;
}
thead {
position: sticky;
top: 0;
}
.table-responsive {
max-height: 400px;
overflow: auto;
position: sticky;
top: 0;
background-color: #fff;
}
<link rel="stylesheet" href="https://stackpath.bootstrapcdn.com/bootstrap/4.1.3/css/bootstrap.min.css" integrity="sha384-MCw98/SFnGE8fJT3GXwEOngsV7Zt27NXFoaoApmYm81iuXoPkFOJwJ8ERdknLPMO" crossorigin="anonymous">
<h1>Table</h1>
<div class="table-responsive " style="width: 100%; height: 670px;">
<!--<table class="table table-striped table-bordered">-->
<table class="table table-hover info">
<thead>
<tr>
<th>ID</th>
<!--<th jhiTranslate="jhiApp.kassa.date_enter">DateEnter</th>-->
<th jhiTranslate="jhiApp.kassa.date_prov">DateProv</th>
<th jhiTranslate="jhiApp.kassa.date_doc">DateDoc</th>
<th jhiTranslate="jhiApp.kassa.num_doc">NumDoc</th>
<th jhiTranslate="jhiApp.kassa.acc_db">AccDb</th>
</tr>
</thead>
<tbody>
<tr>
<td>1</td>
<td>2</td>
<td>3</td>
<td>4</td>
<td>5</td>
</tr>
<tr>
<td>1</td>
<td>2</td>
<td>3</td>
<td>4</td>
<td>5</td>
</tr>
<tr>
<td>1</td>
<td>2</td>
<td>3</td>
<td>4</td>
<td>5</td>
</tr>
<tr>
<td>1</td>
<td>2</td>
<td>3</td>
<td>4</td>
<td>5</td>
</tr>
<tr>
<td>1</td>
<td>2</td>
<td>3</td>
<td>4</td>
<td>5</td>
</tr>
<tr>
<td>1</td>
<td>2</td>
<td>3</td>
<td>4</td>
<td>5</td>
</tr>
<tr>
<td>1</td>
<td>2</td>
<td>3</td>
<td>4</td>
<td>5</td>
</tr>
<tr>
<td>1</td>
<td>2</td>
<td>3</td>
<td>4</td>
<td>5</td>
</tr>
<tr>
<td>1</td>
<td>2</td>
<td>3</td>
<td>4</td>
<td>5</td>
</tr>
<tr>
<td>1</td>
<td>2</td>
<td>3</td>
<td>4</td>
<td>5</td>
</tr>
<tr>
<td>1</td>
<td>2</td>
<td>3</td>
<td>4</td>
<td>5</td>
</tr>
<tr>
<td>1</td>
<td>2</td>
<td>3</td>
<td>4</td>
<td>5</td>
</tr>
<tr>
<td>1</td>
<td>2</td>
<td>3</td>
<td>4</td>
<td>5</td>
</tr>
<tr>
<td>1</td>
<td>2</td>
<td>3</td>
<td>4</td>
<td>5</td>
</tr>
<tr>
<td>1</td>
<td>2</td>
<td>3</td>
<td>4</td>
<td>5</td>
</tr>
<tr>
<td>1</td>
<td>2</td>
<td>3</td>
<td>4</td>
<td>5</td>
</tr>
<tr>
<td>1</td>
<td>2</td>
<td>3</td>
<td>4</td>
<td>5</td>
</tr>
<tr>
<td>1</td>
<td>2</td>
<td>3</td>
<td>4</td>
<td>5</td>
</tr>
<tr>
<td>1</td>
<td>2</td>
<td>3</td>
<td>4</td>
<td>5</td>
</tr>
<tr>
<td>1</td>
<td>2</td>
<td>3</td>
<td>4</td>
<td>5</td>
</tr>
<tr>
<td>1</td>
<td>2</td>
<td>3</td>
<td>4</td>
<td>5</td>
</tr>
<tr>
<td>1</td>
<td>2</td>
<td>3</td>
<td>4</td>
<td>5</td>
</tr>
<tr>
<td>1</td>
<td>2</td>
<td>3</td>
<td>4</td>
<td>5</td>
</tr>
<tr>
<td>1</td>
<td>2</td>
<td>3</td>
<td>4</td>
<td>5</td>
</tr>
<tr>
<td>1</td>
<td>2</td>
<td>3</td>
<td>4</td>
<td>5</td>
</tr>
<tr>
<td>1</td>
<td>2</td>
<td>3</td>
<td>4</td>
<td>5</td>
</tr>
<tr>
<td>1</td>
<td>2</td>
<td>3</td>
<td>4</td>
<td>5</td>
</tr>
<tr>
<td>1</td>
<td>2</td>
<td>3</td>
<td>4</td>
<td>5</td>
</tr>
<tr>
<td>1</td>
<td>2</td>
<td>3</td>
<td>4</td>
<td>5</td>
</tr>
<tr>
<td>1</td>
<td>2</td>
<td>3</td>
<td>4</td>
<td>5</td>
</tr>
<tr>
<td>1</td>
<td>2</td>
<td>3</td>
<td>4</td>
<td>5</td>
</tr>
<tr>
<td>1</td>
<td>2</td>
<td>3</td>
<td>4</td>
<td>5</td>
</tr>
<tr>
<td>1</td>
<td>2</td>
<td>3</td>
<td>4</td>
<td>5</td>
</tr>
<tr>
<td>1</td>
<td>2</td>
<td>3</td>
<td>4</td>
<td>5</td>
</tr>
<tr>
<td>1</td>
<td>2</td>
<td>3</td>
<td>4</td>
<td>5</td>
</tr>
<tr>
<td>1</td>
<td>2</td>
<td>3</td>
<td>4</td>
<td>5</td>
</tr>
<tr>
<td>1</td>
<td>2</td>
<td>3</td>
<td>4</td>
<td>5</td>
</tr>
<tr>
<td>1</td>
<td>2</td>
<td>3</td>
<td>4</td>
<td>5</td>
</tr>
<tr>
<td>1</td>
<td>2</td>
<td>3</td>
<td>4</td>
<td>5</td>
</tr>
<tr>
<td>1</td>
<td>2</td>
<td>3</td>
<td>4</td>
<td>5</td>
</tr>
</tbody>
</table>
</div>
<p>lorem</p>
<p>lorem</p>
<p>lorem</p>
<p>lorem</p>
<p>lorem</p>
<p>lorem</p>
<p>lorem</p>
<p>lorem</p>
<p>lorem</p>
<p>lorem</p>
<p>lorem</p>
<p>lorem</p>
<p>lorem</p>
<p>lorem</p>
<p>lorem</p>
<p>lorem</p>
<p>lorem</p>
<p>lorem</p>
<p>lorem</p>
<p>lorem</p>
<p>lorem</p>
<p>lorem</p>
<p>lorem</p>
<p>lorem</p>
<p>lorem</p>
<p>lorem</p>
<p>lorem</p>
<p>lorem</p>
<p>lorem</p>
<p>lorem</p>
<p>lorem</p>
<p>lorem</p>
<p>lorem</p>
<p>lorem</p>
<p>lorem</p>
<p>lorem</p>
<p>lorem</p>
<p>lorem</p>
<p>lorem</p>
<p>lorem</p>
Scrolling <tbody> with fixed <thead> (well in your case, sticky <thead>) is a log discussed thread.
See the answers to enter link description here, especially this one
If that does not help, see this sticky implementation here and try not to use table but other html tags like for instance plain <div>s and style accordingly. I've seen the example uses description list tags.
I've had a similar situation (with the need for fixed <thead>) so I ended up with this approach. My case implied the material lib but it does not matter the approach of scrolling the "table" body is the same.
You can try my new Angular sticky library. I created it because I missed such functionality and no solutions worked for me. https://ngx-sticky-copy.netlify.app/ It is easy, you only apply *scStickyThead directive on tHead and you go.
Football tournament table
I have table with multi table data which arrange under each other as you see on image under the html code, but I don't understand how to arrange (organize) table rows or table head with table date (sorry I don't know how to right say) that table data of group "A" be placed left and table date of group "B" be placed right of group "A" and same rule apply to group "D" and group "C".
I attached picture under my code for example.
Please help me to do that using only CSS, if it not difficult to explain me your solution with details.
table, th, td {
border: 1px solid #000;
}
table {
width: 50%;
border: 4px solid #f1f1f1;
padding: 5px;
}
<!DOCTYPE html>
<html lang="en">
<head>
<title>Table tournament</title>
<meta charset="UTF-8">
</head>
<body>
<table>
<tr>
<th>Group <span>A</span></th>
<th>И</th>
<th>В</th>
<th>Н</th>
<th>П</th>
<th>Голы</th>
<th>Очки</th>
</tr>
<tr>
<td>1.Бельгия</td>
<td>8</td>
<td>7</td>
<td>1</td>
<td>0</td>
<td>15-2</td>
<td>22</td>
</tr>
<tr>
<td>2.Хорватия</td>
<td>8</td>
<td>5</td>
<td>2</td>
<td>1</td>
<td>11-5</td>
<td>17</td>
</tr>
<tr>
<td>3.Сербия</td>
<td>9</td>
<td>3</td>
<td>2</td>
<td>4</td>
<td>13-10</td>
<td>11</td>
</tr>
<tr>
<td>4.Шотландия</td>
<td>9</td>
<td>2</td>
<td>2</td>
<td>5</td>
<td>6-12</td>
<td>8</td>
</tr>
<tr>
<td>5.Македония</td>
<td>8</td>
<td>2</td>
<td>1</td>
<td>5</td>
<td>6-10</td>
<td>6</td>
</tr>
<tr>
<td>6.Уэльс</td>
<td>8</td>
<td>2</td>
<td>0</td>
<td>6</td>
<td>7-19</td>
<td>6</td>
</tr>
<tr>
<th>Group <span>В</span></th>
<th>И</th>
<th>В</th>
<th>Н</th>
<th>П</th>
<th>Голы</th>
<th>Очки</th>
</tr>
<tr>
<td>1.Италия</td>
<td>8</td>
<td>6</td>
<td>2</td>
<td>0</td>
<td>15-5</td>
<td>20</td>
</tr>
<tr>
<td>2.Болгария</td>
<td>8</td>
<td>3</td>
<td>4</td>
<td>1</td>
<td>13-6</td>
<td>13</td>
</tr>
<tr>
<td>3.Дания</td>
<td>8</td>
<td>3</td>
<td>3</td>
<td>2</td>
<td>9-10</td>
<td>12</td>
</tr>
<tr>
<td>4.Чехия</td>
<td>8</td>
<td>2</td>
<td>3</td>
<td>3</td>
<td>8-8</td>
<td>9</td>
</tr>
<tr>
<td>5.Армения</td>
<td>8</td>
<td>3</td>
<td>0</td>
<td>5</td>
<td>8-10</td>
<td>9</td>
</tr>
<tr>
<td>6.Мальта</td>
<td>8</td>
<td>1</td>
<td>0</td>
<td>7</td>
<td>4-18</td>
<td>3</td>
</tr>
<tr>
<th>Group <span>С</span></th>
<th>И</th>
<th>В</th>
<th>Н</th>
<th>П</th>
<th>Голы</th>
<th>Очки</th>
</tr>
<tr>
<td>1.Германия</td>
<td>8</td>
<td>7</td>
<td>1</td>
<td>0</td>
<td>28-7</td>
<td>22</td>
</tr>
<tr>
<td>2.Швеция</td>
<td>8</td>
<td>5</td>
<td>2</td>
<td>1</td>
<td>14-8</td>
<td>17</td>
</tr>
<tr>
<td>3.Австрия</td>
<td>8</td>
<td>4</td>
<td>2</td>
<td>2</td>
<td>16-8</td>
<td>14</td>
</tr>
<tr>
<td>4.Ирландия</td>
<td>8</td>
<td>3</td>
<td>2</td>
<td>3</td>
<td>13-13</td>
<td>11</td>
</tr>
<tr>
<td>5.Казахстан</td>
<td>8</td>
<td>1</td>
<td>1</td>
<td>6</td>
<td>4-17</td>
<td>4</td>
</tr>
<tr>
<td>6.Фарерские о.</td>
<td>8</td>
<td>0</td>
<td>0</td>
<td>8</td>
<td>3-25</td>
<td>0</td>
</tr>
<tr>
<th>Group <span>D</span></th>
<th>И</th>
<th>В</th>
<th>Н</th>
<th>П</th>
<th>Голы</th>
<th>Очки</th>
</tr>
<tr>
<td>1.Нидерланды</td>
<td>8</td>
<td>7</td>
<td>1</td>
<td>0</td>
<td>24-4</td>
<td>22</td>
</tr>
<tr>
<td>2.Венгрия</td>
<td>8</td>
<td>4</td>
<td>2</td>
<td>2</td>
<td>18-12</td>
<td>14</td>
</tr>
<tr>
<td>3.Турция</td>
<td>8</td>
<td>4</td>
<td>1</td>
<td>3</td>
<td>14-7</td>
<td>13</td>
</tr>
<tr>
<td>4.Румыния</td>
<td>8</td>
<td>4</td>
<td>1</td>
<td>3</td>
<td>13-12</td>
<td>13</td>
</tr>
<tr>
<td>5.Эстония</td>
<td>8</td>
<td>2</td>
<td>1</td>
<td>5</td>
<td>6-16</td>
<td>7</td>
</tr>
<tr>
<td>Андорра</td>
<td>8</td>
<td>0</td>
<td>0</td>
<td>8</td>
<td>0-24</td>
<td>0</td>
</tr>
</table>
</body>
</html>
Any help would be greatly appreciated.
This image demonstrates how blocks of th with td should arranges side by side.
table, th, td {
border: 1px solid #000;
}
table {
width: 50%;
border: 4px solid #f1f1f1;
padding: 5px;
}
<!DOCTYPE html>
<html lang="en">
<head>
<title>Table tournament</title>
<meta charset="UTF-8">
</head>
<body>
<table>
<tr>
<td>
<table>
<tr>
<th>Group <span>A</span></th>
<th>И</th>
<th>В</th>
<th>Н</th>
<th>П</th>
<th>Голы</th>
<th>Очки</th>
</tr>
<tr>
<td>1.Бельгия</td>
<td>8</td>
<td>7</td>
<td>1</td>
<td>0</td>
<td>15-2</td>
<td>22</td>
</tr>
<tr>
<td>2.Хорватия</td>
<td>8</td>
<td>5</td>
<td>2</td>
<td>1</td>
<td>11-5</td>
<td>17</td>
</tr>
<tr>
<td>3.Сербия</td>
<td>9</td>
<td>3</td>
<td>2</td>
<td>4</td>
<td>13-10</td>
<td>11</td>
</tr>
<tr>
<td>4.Шотландия</td>
<td>9</td>
<td>2</td>
<td>2</td>
<td>5</td>
<td>6-12</td>
<td>8</td>
</tr>
<tr>
<td>5.Македония</td>
<td>8</td>
<td>2</td>
<td>1</td>
<td>5</td>
<td>6-10</td>
<td>6</td>
</tr>
<tr>
<td>6.Уэльс</td>
<td>8</td>
<td>2</td>
<td>0</td>
<td>6</td>
<td>7-19</td>
<td>6</td>
</tr>
</table>
</td>
<td>
<table>
<tr>
<th>Group <span>В</span></th>
<th>И</th>
<th>В</th>
<th>Н</th>
<th>П</th>
<th>Голы</th>
<th>Очки</th>
</tr>
<tr>
<td>1.Италия</td>
<td>8</td>
<td>6</td>
<td>2</td>
<td>0</td>
<td>15-5</td>
<td>20</td>
</tr>
<tr>
<td>2.Болгария</td>
<td>8</td>
<td>3</td>
<td>4</td>
<td>1</td>
<td>13-6</td>
<td>13</td>
</tr>
<tr>
<td>3.Дания</td>
<td>8</td>
<td>3</td>
<td>3</td>
<td>2</td>
<td>9-10</td>
<td>12</td>
</tr>
<tr>
<td>4.Чехия</td>
<td>8</td>
<td>2</td>
<td>3</td>
<td>3</td>
<td>8-8</td>
<td>9</td>
</tr>
<tr>
<td>5.Армения</td>
<td>8</td>
<td>3</td>
<td>0</td>
<td>5</td>
<td>8-10</td>
<td>9</td>
</tr>
<tr>
<td>6.Мальта</td>
<td>8</td>
<td>1</td>
<td>0</td>
<td>7</td>
<td>4-18</td>
<td>3</td>
</tr>
</table>
</td>
</tr>
<tr>
<td>
<table>
<tr>
<th>Group <span>С</span></th>
<th>И</th>
<th>В</th>
<th>Н</th>
<th>П</th>
<th>Голы</th>
<th>Очки</th>
</tr>
<tr>
<td>1.Германия</td>
<td>8</td>
<td>7</td>
<td>1</td>
<td>0</td>
<td>28-7</td>
<td>22</td>
</tr>
<tr>
<td>2.Швеция</td>
<td>8</td>
<td>5</td>
<td>2</td>
<td>1</td>
<td>14-8</td>
<td>17</td>
</tr>
<tr>
<td>3.Австрия</td>
<td>8</td>
<td>4</td>
<td>2</td>
<td>2</td>
<td>16-8</td>
<td>14</td>
</tr>
<tr>
<td>4.Ирландия</td>
<td>8</td>
<td>3</td>
<td>2</td>
<td>3</td>
<td>13-13</td>
<td>11</td>
</tr>
<tr>
<td>5.Казахстан</td>
<td>8</td>
<td>1</td>
<td>1</td>
<td>6</td>
<td>4-17</td>
<td>4</td>
</tr>
<tr>
<td>6.Фарерские о.</td>
<td>8</td>
<td>0</td>
<td>0</td>
<td>8</td>
<td>3-25</td>
<td>0</td>
</tr>
</table>
</td>
<td>
<table>
<tr>
<th>Group <span>D</span></th>
<th>И</th>
<th>В</th>
<th>Н</th>
<th>П</th>
<th>Голы</th>
<th>Очки</th>
</tr>
<tr>
<td>1.Нидерланды</td>
<td>8</td>
<td>7</td>
<td>1</td>
<td>0</td>
<td>24-4</td>
<td>22</td>
</tr>
<tr>
<td>2.Венгрия</td>
<td>8</td>
<td>4</td>
<td>2</td>
<td>2</td>
<td>18-12</td>
<td>14</td>
</tr>
<tr>
<td>3.Турция</td>
<td>8</td>
<td>4</td>
<td>1</td>
<td>3</td>
<td>14-7</td>
<td>13</td>
</tr>
<tr>
<td>4.Румыния</td>
<td>8</td>
<td>4</td>
<td>1</td>
<td>3</td>
<td>13-12</td>
<td>13</td>
</tr>
<tr>
<td>5.Эстония</td>
<td>8</td>
<td>2</td>
<td>1</td>
<td>5</td>
<td>6-16</td>
<td>7</td>
</tr>
<tr>
<td>Андорра</td>
<td>8</td>
<td>0</td>
<td>0</td>
<td>8</td>
<td>0-24</td>
<td>0</td>
</tr>
</table>
</td>
</tr>
</table>
</body>
</html>
I have a css class on table <tr> tags but i want to stop it from being added on one <td>
is this possible? can i add a seperate class to the specific <td> to stop the <tr>'s class being added?
You could use the :not selector (which you can use to filter all bar the selector within the brackets):
table td:not(.this) {
background: red;
color: blue;
}
<table>
<tr>
<td>1</td>
<td>2</td>
<td>3</td>
<td>4</td>
<td>5</td>
</tr>
<tr>
<td>1</td>
<td class="this">2</td>
<td>3</td>
<td>4</td>
<td>5</td>
</tr>
<tr>
<td>1</td>
<td>2</td>
<td>3</td>
<td>4</td>
<td>5</td>
</tr>
<tr>
<td>1</td>
<td>2</td>
<td>3</td>
<td>4</td>
<td>5</td>
</tr>
</table>
Alternatively, you could use a class selector if you wanted to style it differently (rather than not at all):
table tr {
background: red;
color: blue;
}
.this {
background: green;
color: white;
}
<table>
<tr>
<td>1</td>
<td>2</td>
<td>3</td>
<td>4</td>
<td>5</td>
</tr>
<tr>
<td>1</td>
<td class="this">2</td>
<td>3</td>
<td>4</td>
<td>5</td>
</tr>
<tr>
<td>1</td>
<td>2</td>
<td>3</td>
<td>4</td>
<td>5</td>
</tr>
<tr>
<td>1</td>
<td>2</td>
<td>3</td>
<td>4</td>
<td>5</td>
</tr>
</table>
tr.MyClassName{
// styling goes here
}
That should only style the tr but not the td.
This is a simple little table with header and footer all css and html the top header remains fixed if you scroll however;
My header columns do not line up with the table columns. Does anyone see what I am doing wrong?
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01//EN" "http://www.w3.org/TR/html4/strict.dtd">
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8">
<title>Untitled Document</title>
<style type="text/css">
p {
margin:0 0 1em ;
}
table p {
margin:0;
}
.wrap {
margin: 0 0 0 0;
float:left;
position:relative;
overflow:hidden;
padding:0 0 0;
border:7px solid #CCCCCC;
/* width:1800px; */
}
.inner2 {
float:left;
/* width:1800px; */
height:570px;
position:relative;
padding:60px 0 17px;
overflow-y:hidden;
overflow-x:auto;
}
.inner {
/* width:1800px; */
float:left;
height:570px;
overflow-y:auto;
overflow-x:hidden;
}
.ylw {
background-color:yellow;
}
.rd {
background-color:red;
}
.grn {
background-color:#339966;
}
table {
/* width:1800px; */
margin:0 0 0 0;
border-collapse:collapse;
float:left;
}
td {
padding:0 0 0 0;
border:1px solid #000000;
text-align:center;
font-size:14px;
}
tfoot th, thead th {
font-weight:bold;
text-align:center;
border:1px solid #000000;
padding:0 0 0 0;
font-size:14px;
}
thead th {
border:1px solid #000000;
text-align:center;
padding:0 0 0 0;
}
thead tr p {
margin: 0 0 0 -7px;
font-size:14px;
position:absolute;
text-align:center;
padding:0 0 0 0;
top:0;
}
.last {
padding-right:15px!important;
}
</style>
</head>
<body>
<h1>Table with fixed header</h1>
<p>Notes: The header is part of the same table and not a separate table on top. The width of the table cells or header cells is not defined and will match whatever content is in the cells. The table can be a fluid length and will resize within reasonable limits accordingly.</p>
<p>You will be limited by the position of the header rows elements though as they can't really me moved around anymore thatn they are now.</p>
<div class='wrap'>
<div class='inner2'>
<div class='inner'>
<table id='data' cellspacing='0' cellpadding='0'>
<thead>
<tr>
<th><p>Jan</p></th>
<th><p>Feb</p></th>
<th><p>Mar</p></th>
<th><p>Apr</p></th>
<th><p>May</p></th>
<th><p>Jun</p></th>
<th><p>Jul</p></th>
<th><p>Aug</p></th>
<th><p>September</p></th>
<th><p>Oct</p></th>
<th><p>Nov</p></th>
<th class='last'><p>Dec</p></th>
</tr>
</thead>
<tfoot>
<tr>
<th><p>Jan</p></th>
<th><p>Feb</p></th>
<th><p>Mar</p></th>
<th><p>Apr</p></th>
<th><p>May</p></th>
<th><p>Jun</p></th>
<th><p>Jul</p></th>
<th><p>Aug</p></th>
<th><p>September</p></th>
<th><p>Oct</p></th>
<th><p>Nov</p></th>
<th class='last'><p>Dec</p></th>
</tr>
</tfoot>
<tbody>
<tr>
<td>1</td>
<td>3</td>
<td>5</td>
<td>1</td>
<td>1</td>
<td>3</td>
<td>1</td>
<td>5</td>
<td>7</td>
<td>1</td>
<td>1</td>
<td class='last'>3</td>
</tr>
<tr>
<td>1</td>
<td>3</td>
<td>5</td>
<td>1</td>
<td>1</td>
<td>3</td>
<td>1</td>
<td>1</td>
<td>1</td>
<td>3 more data</td>
<td>5</td>
<td class='last'>7</td>
</tr>
<tr>
<td>2</td>
<td>4</td>
<td>6</td>
<td>1</td>
<td>1</td>
<td>3</td>
<td>1</td>
<td>23</td>
<td>4</td>
<td>1</td>
<td>6</td>
<td class='last'>6</td>
</tr>
<tr>
<td>1</td>
<td>1</td>
<td>6</td>
<td>1</td>
<td>4</td>
<td>7</td>
<td>1</td>
<td>7</td>
<td>1</td>
<td>1</td>
<td>3</td>
<td class='last'>6</td>
</tr>
<tr>
<td>2</td>
<td>3 with more data</td>
<td>2</td>
<td>3</td>
<td>3</td>
<td>3</td>
<td>8</td>
<td>1</td>
<td>1</td>
<td>2</td>
<td>8</td>
<td class='last'>6</td>
</tr>
<tr>
<td>6</td>
<td>4</td>
<td>4</td>
<td>4</td>
<td>2</td>
<td>9</td>
<td>4</td>
<td>4</td>
<td>6</td>
<td>1</td>
<td>1</td>
<td class='last'>3</td>
</tr>
<tr>
<td>1</td>
<td>1</td>
<td>3</td>
<td>7</td>
<td>4</td>
<td>5</td>
<td>5</td>
<td>2</td>
<td>0</td>
<td>3</td>
<td>23</td>
<td class='last'>6</td>
</tr>
<tr>
<td>7</td>
<td>4</td>
<td>2</td>
<td>67</td>
<td>2</td>
<td>1</td>
<td>1</td>
<td>3</td>
<td>1</td>
<td>4</td>
<td>4</td>
<td class='last'>4</td>
</tr>
<tr>
<td>2</td>
<td>4</td>
<td>3</td>
<td>1</td>
<td>1</td>
<td>1</td>
<td>3</td>
<td>2</td>
<td>2</td>
<td>5</td>
<td>65</td>
<td class='last'>4</td>
</tr>
<tr>
<td>2</td>
<td>4</td>
<td>4</td>
<td>1</td>
<td>2</td>
<td>13</td>
<td>6</td>
<td>1</td>
<td>1</td>
<td>3</td>
<td>7</td>
<td class='last'>4</td>
</tr>
<tr>
<td>1</td>
<td>3</td>
<td>5</td>
<td>1</td>
<td>1</td>
<td>3</td>
<td>1</td>
<td>5</td>
<td>7</td>
<td>1</td>
<td>1</td>
<td class='last'>3</td>
</tr>
<tr>
<td>1</td>
<td>3</td>
<td>5</td>
<td>1</td>
<td>1</td>
<td>3</td>
<td>1</td>
<td>1</td>
<td>1</td>
<td>3 more data</td>
<td>5</td>
<td class='last'>7</td>
</tr>
<tr>
<td>2</td>
<td>4</td>
<td>6</td>
<td>1</td>
<td>1</td>
<td>3</td>
<td>1</td>
<td>23</td>
<td>4</td>
<td>1</td>
<td>6</td>
<td class='last'>6</td>
</tr>
<tr>
<td>1</td>
<td>1</td>
<td>6</td>
<td>1</td>
<td>4</td>
<td>7</td>
<td>1</td>
<td>7</td>
<td>1</td>
<td>1</td>
<td>3</td>
<td class='last'>6</td>
</tr>
<tr>
<td>2</td>
<td>3 with more data</td>
<td>2</td>
<td>3</td>
<td>3</td>
<td>3</td>
<td>8</td>
<td>1</td>
<td>1</td>
<td>2</td>
<td>8</td>
<td class='last'>6</td>
</tr>
<tr>
<td>6</td>
<td>4</td>
<td>4</td>
<td>4</td>
<td>2</td>
<td>9</td>
<td>4</td>
<td>4</td>
<td>6</td>
<td>1</td>
<td>1</td>
<td class='last'>3</td>
</tr>
<tr>
<td>1</td>
<td>1</td>
<td>3</td>
<td>7</td>
<td>4</td>
<td>5</td>
<td>5</td>
<td>2</td>
<td>0</td>
<td>3</td>
<td>23</td>
<td class='last'>6</td>
</tr>
<tr>
<td>7</td>
<td>4</td>
<td>2</td>
<td>67</td>
<td>2</td>
<td>1</td>
<td>1</td>
<td>3</td>
<td>1</td>
<td>4</td>
<td>4</td>
<td class='last'>4</td>
</tr>
<tr>
<td>2</td>
<td>4</td>
<td>3</td>
<td>1</td>
<td>1</td>
<td>1</td>
<td>3</td>
<td>2</td>
<td>2</td>
<td>5</td>
<td>65</td>
<td class='last'>4</td>
</tr>
<tr>
<td>2</td>
<td>4</td>
<td>4</td>
<td>1</td>
<td>2</td>
<td>13</td>
<td>6</td>
<td>1</td>
<td>1</td>
<td>3</td>
<td>7</td>
<td class='last'>4</td>
</tr>
<tr>
<td>1</td>
<td>3</td>
<td>5</td>
<td>1</td>
<td>1</td>
<td>3</td>
<td>1</td>
<td>5</td>
<td>7</td>
<td>1</td>
<td>1</td>
<td class='last'>3</td>
</tr>
<tr>
<td>1</td>
<td>3</td>
<td>5</td>
<td>1</td>
<td>1</td>
<td>3</td>
<td>1</td>
<td>1</td>
<td>1</td>
<td>3 more data</td>
<td>5</td>
<td class='last'>7</td>
</tr>
<tr>
<td>2</td>
<td>4</td>
<td>6</td>
<td>1</td>
<td>1</td>
<td>3</td>
<td>1</td>
<td>23</td>
<td>4</td>
<td>1</td>
<td>6</td>
<td class='last'>6</td>
</tr>
<tr>
<td>1</td>
<td>1</td>
<td>6</td>
<td>1</td>
<td>4</td>
<td>7</td>
<td>1</td>
<td>7</td>
<td>1</td>
<td>1</td>
<td>3</td>
<td class='last'>6</td>
</tr>
<tr>
<td>2</td>
<td>3 with more data</td>
<td>2</td>
<td>3</td>
<td>3</td>
<td>3</td>
<td>8</td>
<td>1</td>
<td>1</td>
<td>2</td>
<td>8</td>
<td class='last'>6</td>
</tr>
<tr>
<td>6</td>
<td>4</td>
<td>4</td>
<td>4</td>
<td>2</td>
<td>9</td>
<td>4</td>
<td>4</td>
<td>6</td>
<td>1</td>
<td>1</td>
<td class='last'>3</td>
</tr>
<tr>
<td>1</td>
<td>1</td>
<td>3</td>
<td>7</td>
<td>4</td>
<td>5</td>
<td>5</td>
<td>2</td>
<td>0</td>
<td>3</td>
<td>23</td>
<td class='last'>6</td>
</tr>
<tr>
<td>7</td>
<td>4</td>
<td>2</td>
<td>67</td>
<td>2</td>
<td>1</td>
<td>1</td>
<td>3</td>
<td>1</td>
<td>4</td>
<td>4</td>
<td class='last'>4</td>
</tr>
<tr>
<td>2</td>
<td>4</td>
<td>3</td>
<td>1</td>
<td>1</td>
<td>1</td>
<td>3</td>
<td>2</td>
<td>2</td>
<td>5</td>
<td>65</td>
<td class='last'>4</td>
</tr>
<tr>
<td>2</td>
<td>4</td>
<td>4</td>
<td>1</td>
<td>2</td>
<td>13</td>
<td>6</td>
<td>1</td>
<td>1</td>
<td>3</td>
<td>7</td>
<td class='last'>4</td>
</tr>
<tr>
<td>1</td>
<td>3</td>
<td>5</td>
<td>1</td>
<td>1</td>
<td>3</td>
<td>1</td>
<td>5</td>
<td>7</td>
<td>1</td>
<td>1</td>
<td class='last'>3</td>
</tr>
<tr>
<td>1</td>
<td>3</td>
<td>5</td>
<td>1</td>
<td>1</td>
<td>3</td>
<td>1</td>
<td>1</td>
<td>1</td>
<td>3 more data</td>
<td>5</td>
<td class='last'>7</td>
</tr>
<tr>
<td>2</td>
<td>4</td>
<td>6</td>
<td>1</td>
<td>1</td>
<td>3</td>
<td>1</td>
<td>23</td>
<td>4</td>
<td>1</td>
<td>6</td>
<td class='last'>6</td>
</tr>
<tr>
<td>1</td>
<td>1</td>
<td>6</td>
<td>1</td>
<td>4</td>
<td>7</td>
<td>1</td>
<td>7</td>
<td>1</td>
<td>1</td>
<td>3</td>
<td class='last'>6</td>
</tr>
<tr>
<td>2</td>
<td>3 with more data</td>
<td>2</td>
<td>3</td>
<td>3</td>
<td>3</td>
<td>8</td>
<td>1</td>
<td>1</td>
<td>2</td>
<td>8</td>
<td class='last'>6</td>
</tr>
<tr>
<td>6</td>
<td>4</td>
<td>4</td>
<td>4</td>
<td>2</td>
<td>9</td>
<td>4</td>
<td>4</td>
<td>6</td>
<td>1</td>
<td>1</td>
<td class='last'>3</td>
</tr>
<tr>
<td>1</td>
<td>1</td>
<td>3</td>
<td>7</td>
<td>4</td>
<td>5</td>
<td>5</td>
<td>2</td>
<td>0</td>
<td>3</td>
<td>23</td>
<td class='last'>6</td>
</tr>
<tr>
<td>7</td>
<td>4</td>
<td>2</td>
<td>67</td>
<td>2</td>
<td>1</td>
<td>1</td>
<td>3</td>
<td>1</td>
<td>4</td>
<td>4</td>
<td class='last'>4</td>
</tr>
<tr>
<td>2</td>
<td>4</td>
<td>3</td>
<td>1</td>
<td>1</td>
<td>1</td>
<td>3</td>
<td>2</td>
<td>2</td>
<td>5</td>
<td>65</td>
<td class='last'>4</td>
</tr>
<tr>
<td>2</td>
<td>4</td>
<td>4</td>
<td>1</td>
<td>2</td>
<td>13</td>
<td>6</td>
<td>1</td>
<td>1</td>
<td>3</td>
<td>7</td>
<td class='last'>4</td>
</tr>
<tr>
<td>1</td>
<td>3</td>
<td>5</td>
<td>1</td>
<td>1</td>
<td>3</td>
<td>1</td>
<td>5</td>
<td>7</td>
<td>1</td>
<td>1</td>
<td class='last'>3</td>
</tr>
<tr>
<td>1</td>
<td>3</td>
<td>5</td>
<td>1</td>
<td>1</td>
<td>3</td>
<td>1</td>
<td>1</td>
<td>1</td>
<td>3 more data</td>
<td>5</td>
<td class='last'>7</td>
</tr>
<tr>
<td>2</td>
<td>4</td>
<td>6</td>
<td>1</td>
<td>1</td>
<td>3</td>
<td>1</td>
<td>23</td>
<td>4</td>
<td>1</td>
<td>6</td>
<td class='last'>6</td>
</tr>
<tr>
<td>1</td>
<td>1</td>
<td>6</td>
<td>1</td>
<td>4</td>
<td>7</td>
<td>1</td>
<td>7</td>
<td>1</td>
<td>1</td>
<td>3</td>
<td class='last'>6</td>
</tr>
<tr>
<td>1</td>
<td>3</td>
<td>5</td>
<td>1</td>
<td>1</td>
<td>3</td>
<td>1</td>
<td>1</td>
<td>1</td>
<td>3 more data</td>
<td>5</td>
<td class='last'>7</td>
</tr>
</tbody>
</table>
</div>
</div>
</div>
</body>
</html>
you are absolutely positioning and have negative margins on your P tags within the TH tags
this rule: thead tr p try zeroing out the margin on that rule.
thead tr p {
margin: 0; /* zero out margin */
font-size: 14px;
position: absolute;
text-align: center;
padding: 0;
top: 0;
}
if you want the text-align:center to work when absolutely positioning the P tags.. you will need to add a specific width to them
EDIT:
you also have your TFOOT below your THEAD instead of being after the TBODY
http://jsfiddle.net/MP8Bc/
it lines up but they are aligned left... and wont align center unless you add widths since they are absolutely positioned , which means they are out of the document flow