I am trying to make table inside of table meant nested table. Now its look like this screenshot . But i need align from left. Because i have use same count column in each row.
You can see what i have tried to get this output.
Thanks in advance
.report-table {
border-collapse: collapse;
width: 100%;
font-family: Arial;
}
.report-table .col-name {
width: 150px;
}
.report-table .col-title {
width: 150px;
}
.report-table .col-carried {
width: 60px;
}
.report-table .col-earned {
width: 60px;
}
.report-table .col-used {
width: 60px;
}
.report-table .col-scheduled {
width: 60px;
}
.report-table .col-balance {
width: 60px;
}
.report-table .col-to-be {
width: 60px;
}
.report-table .col-available {
width: 60px;
}
.report-table .inner-table tr td{
border: 0;
}
.report-table.hr-table .inner-table {
background: none;
border: 0;
}
.report-table.hr-table .inner-table td {
vertical-align: top;
}
.report-table.hr-table tr {
border-top: 1px solid #333;
}
.report-table.hr-table td,
.report-table.hr-table th{
padding: 10px;
vertical-align: top;
text-align: left;
}
.report-table.hr-table .inner-table td:first-child {
padding-left: 0;
}
<table class="tablesorter hr-table hr-table-striped report-table">
<thead>
<tr>
<th class="header col-name">Name<span></span></th>
<th class="header col-title">Leave Title<span></span></th>
<th class="header col-carried">Carried Over<span></span></th>
<th class="header col-earned">Earned<span></span></th>
<th class="header col-used">Used <span></span></th>
<th class="header col-scheduled">Scheduled <span></span></th>
<th class="header col-balance">Balance<span></span></th>
<th class="header col-to-be">To-be-earned<span></span></th>
<th class="header col-available">Avaliable<span></span></th>
</tr>
</thead>
<tbody>
<tr>
<td class="col-name">Ethan Hunt</td>
<td colspan="8">
<table class=" hr-table inner-table">
<tr>
<td class="col-title">Vacation</td>
<td class="col-carried">10</td>
<td class="col-earned">20</td>
<td class="col-used">20</td>
<td class="col-scheduled">5</td>
<td class="col-balance">0</td>
<td class="col-to-be">10</td>
<td class="col-available">5</td>
</tr>
<tr>
<td class="col-title">Sickness</td>
<td class="col-carried">10</td>
<td class="col-earned">20</td>
<td class="col-used">20</td>
<td class="col-scheduled">5</td>
<td class="col-balance">0</td>
<td class="col-to-be">10</td>
<td class="col-available">5</td>
</tr>
<tr>
<td class="col-title">Training</td>
<td class="col-carried">10</td>
<td class="col-earned">20</td>
<td class="col-used">20</td>
<td class="col-scheduled">5</td>
<td class="col-balance">0</td>
<td class="col-to-be">10</td>
<td class="col-available">5</td>
</tr>
</table>
</td>
</tr>
<tr>
<td class="col-name">Lara Craft</td>
<td class="col-title">Training</td>
<td class="col-carried">10</td>
<td class="col-earned">20</td>
<td class="col-used">20</td>
<td class="col-scheduled">5</td>
<td class="col-balance">0</td>
<td class="col-to-be">10</td>
<td class="col-available">5</td>
</tr>
<tr>
<td class="col-name">Ethan Hunt</td>
<td colspan="8">
<table class=" hr-table inner-table">
<tr>
<td class="col-title">Vacation</td>
<td class="col-carried">10</td>
<td class="col-earned">20</td>
<td class="col-used">20</td>
<td class="col-scheduled">5</td>
<td class="col-balance">0</td>
<td class="col-to-be">10</td>
<td class="col-available">5</td>
</tr>
<tr>
<td class="col-title">Sickness</td>
<td class="col-carried">10</td>
<td class="col-earned">20</td>
<td class="col-used">20</td>
<td class="col-scheduled">5</td>
<td class="col-balance">0</td>
<td class="col-to-be">10</td>
<td class="col-available">5</td>
</tr>
<tr>
<td class="col-title">Training</td>
<td class="col-carried">10</td>
<td class="col-earned">20</td>
<td class="col-used">20</td>
<td class="col-scheduled">5</td>
<td class="col-balance">0</td>
<td class="col-to-be">10</td>
<td class="col-available">5</td>
</tr>
</table>
</td>
</tr>
</tbody>
</table>
Here is JSFIDDLE
Any nested table complicates the entire layout and functionality of all tables involved. <tbody> element was created to allow us to divide a table into sections that share the same exact columns. It makes very little sense to introduce another table with the same type of data and shove it it into one column. There's no advantage to wrap it in a <table> element then keep it in one column of another table, all cells within the nested <table> are still subject to the style and behavior of the inner <table>. That one column that is just the name column is stretched out in order to align to the column of the outer <table> makes no sense.
Plunker
Details are commented extensively in demos. Although responsive (minimally), it is best viewed in Full page mode
Demo
body,
html {
width: 100%;
height: 100%;
font: 400 100%/1.2 Arial
}
* {
margin: 0;
padding: 0;
border: 0
}
/* table-layout: fixed gives us more control over <td>
|| dimensions and <table> behavior
*/
.report-table {
table-layout: fixed;
border-collapse: collapse;
width: 100%;
margin: 30px auto;
font-size: 1em
}
thead tr {
border-bottom: 3px double #111
}
/* Each <th> in the <thead> has text that clips into an
|| automatic ellipsis if and when <table> gets narrower
*/
thead th {
padding: 10px 5px 5px;
overflow-x: hidden;
white-space: nowrap;
text-overflow: ellipsis
}
tbody tr {
border: 1px transparent
}
tbody tr:last-of-type {
border-bottom: 1px solid #111
}
tbody th,
td {
vertical-align: top;
text-align: left;
padding: 10px
}
.full {
border-bottom: 1px solid #111
}
td {
text-align: center
}
col {
width: 10%
}
col.name,
col.type {
width: 15%
}
/* CSS HIghlight Featue */
/* All checkboxes and radio buttons are
|| display:none;
*/
.chx,
.rad,
.reset {
display: none
}
label {
font: inherit;
cursor: pointer;
display: inline-block
}
/* These rulesets will highlight a column when
|| a <label> is clicked which in turn checks the
|| checkbox which in turn changes the background
|| color of a column
*/
#chx1:checked~table col.name,
#chx2:checked~table col.type {
background: #ff0
}
#chx3:checked~table col.carried,
#chx4:checked~table col.earned {
background: #00ff80
}
#chx5:checked~table col.used {
background: #ff8080
}
#chx6:checked~table col.scheduled,
#chx7:checked~table col.balance,
#chx8:checked~table col.yet,
#chx9:checked~table col.available {
background: #ff0
}
.on {
display: inline-block
}
/* These radio buttons operate in the same
|| manner as the checkboxes with some exceptions:
|| - There's 2 <label>s for each radio
|| - The <label>s toggle a row highlighting
|| - The <label>s alternate between display:
|| none and inline-block.
|| - Only one <tbody> at a time may be highlighted
*/
#rad1:checked~table tbody#e-hunt-40318,
#rad2:checked~table tbody#l-craft-61232,
#rad3:checked~table tbody#r-hertz-20663 {
background: rgba(0, 255, 255, .5)
}
#rad1:checked~table tbody#e-hunt-40318 .reset {
display: inline-block
}
#rad1:checked~table tbody#e-hunt-40318 .on {
display: none
}
#rad1:checked~table tbody#e-hunt-40318 tr,
#rad3:checked~table tbody#r-hertz-20663 tr {
border-bottom: 1px dashed red
}
#rad2:checked~table tbody#l-craft-61232 .reset {
display: inline-block
}
#rad2:checked~table tbody#l-craft-61232 .on {
display: none
}
#rad3:checked~table tbody#r-hertz-20663 .reset {
display: inline-block
}
#rad3:checked~table tbody#r-hertz-20663 .on {
display: none
}
#reset:checked~table tbody {
background: initial
}
<!DOCTYPE html>
<html>
<head>
<meta charset="utf-8">
<link href='report.css' rel='stylesheet'>
<style>
</style>
</head>
<body>
<!--
|[Highlighting (Optional)
These checkboxes and radio buttons are optional.
They are part of an intricate highlighting feature
that leverages:
- cascading
- sibling selectors: ~
- <label> and 'for' attribute
- checkbox and radio <input>
input.chx highlights columns-->
<input id='chx1' class='chx' type='checkbox'>
<input id='chx2' class='chx' type='checkbox'>
<input id='chx3' class='chx' type='checkbox'>
<input id='chx4' class='chx' type='checkbox'>
<input id='chx5' class='chx' type='checkbox'>
<input id='chx6' class='chx' type='checkbox'>
<input id='chx7' class='chx' type='checkbox'>
<input id='chx8' class='chx' type='checkbox'>
<input id='chx9' class='chx' type='checkbox'>
<!--input.rad highlights a row-->
<input id='rad1' class='rad' name='rad' type='radio'>
<input id='rad2' class='rad' name='rad' type='radio'>
<input id='rad3' class='rad' name='rad' type='radio'>
<input id='reset' class='rad' name='rad' type='radio'>
<table class="tablesorter hr-table hr-table-striped report-table">
<!--
|[<colgroup>/<col> (Recommended)
<colgroup> and <col> are elements with a
special purpose of assigning a limited number of
style properties to a column (vertical stack of
<td>). Using them will reduce amount of classes
assigned to individual cells.-->
<colgroup>
<col class='name'>
<col class='type'>
<col class='carried'>
<col class='earned'>
<col class='used'>
<col class='scheduled'>
<col class='balance'>
<col class='yet'>
<col class='available'>
</colgroup>
<thead>
<tr>
<th>Name</th>
<th>Leave Type</th>
<th>Carried Over</th>
<th>Earned</th>
<th>Used</th>
<th>Scheduled</th>
<th>Balance</th>
<th>Yet Earned</th>
<th>Avaliable</th>
</tr>
</thead>
<!--
|[<tbody> (Required)
Instead of using a whole new <table> and shoving it
inside of a <td>, use a <tbody>. <tbody> is semantically,
logically, and aesthetically a superior choice
compared to a nested <table>.
<tbody> is one of the 3 major sections of a <table>
and it's the only one of those 3 (the other 2 are
<thead> and <tfoot>) that are actually required when
building a <table>. Although one can build a <table>
and neglect adding the <tbody>, all modern browsers
will add it in automatically. Another unique character
istic of <tbody> that the other 2 lacks is that we
can have multiple <tbody> in a <table>.
-->
<!--| Each <tbody> represents an employee's leave data
The class is .full (fulltime employee) or .part
(parttime employee). The id is the employee's
first initial, last name, and ID number.
-->
<tbody class='full' id='e-hunt-40318'>
<tr>
<!--| The first column comprises of <th>:
- Data: Employee's Full Name
- Class: .part or .full
- Style: From col.name
- Markup: <th> one row if th.part; 3 rows if th.full
by using the rowspan attribute.
-->
<th rowspan='3'>
<!--| <label>s toggle the radio buttons and the radio
buttons toggle row highlighting.
-->
<label for='rad1' class='on'>Ethan Hunt</label>
<label for='reset' class='reset'>Ethan Hunt</label>
</th>
<td>Vacation</td>
<td>10</td>
<td>20</td>
<td>20</td>
<td>5</td>
<td>0</td>
<td>10</td>
<td>5</td>
</tr>
<tr>
<td>Illness</td>
<td>10</td>
<td>20</td>
<td>20</td>
<td>5</td>
<td>0</td>
<td>10</td>
<td>5</td>
</tr>
<tr>
<td>Training</td>
<td>10</td>
<td>20</td>
<td>20</td>
<td>5</td>
<td>0</td>
<td>10</td>
<td>5</td>
</tr>
</tbody>
<tbody class='part' id='l-craft-61232'>
<tr>
<th>
<label for='rad2' class='on'>Lara Craft</label>
<label for='reset' class='reset'>Lara Craft</label>
</th>
<td>Training</td>
<td>10</td>
<td>20</td>
<td>20</td>
<td>5</td>
<td>0</td>
<td>10</td>
<td>5</td>
</tr>
</tbody>
<tbody class='full' id='r-hertz-20663'>
<tr>
<th rowspan='3'>
<label for='rad3' class='on'>Richard Hertz</label>
<label for='reset' class='reset'>Richard Hertz</label>
</th>
<td>Vacation</td>
<td>10</td>
<td>20</td>
<td>20</td>
<td>5</td>
<td>0</td>
<td>10</td>
<td>5</td>
</tr>
<tr>
<td>Illness</td>
<td>10</td>
<td>20</td>
<td>20</td>
<td>5</td>
<td>0</td>
<td>10</td>
<td>5</td>
</tr>
<tr>
<td>Training</td>
<td>10</td>
<td>20</td>
<td>20</td>
<td>5</td>
<td>0</td>
<td>10</td>
<td>5</td>
</tr>
</tbody>
<!--<label for='id'> (Optional)
|[<label for='id'></label> <input id='id' type='radio'>
<tfoot> contains the <label>s that toggle the
columns' highlighting. Note that each <label>
has a for attribute which value is the id of
the checkbox that the <label> is associated with.
This association allows the hidden <input>s
to react from any click on it's associated
<label>
-->
<tfoot>
<tr>
<td>
<label for='chx1'>COL1</label>
</td>
<td>
<label for='chx2'>COL2</label>
</td>
<td>
<label for='chx3'>COL3</label>
</td>
<td>
<label for='chx4'>COL4</label>
</td>
<td>
<label for='chx5'>COL5</label>
</td>
<td>
<label for='chx6'>COL6</label>
</td>
<td>
<label for='chx7'>COL7</label>
</td>
<td>
<label for='chx8'>COL8</label>
</td>
<td>
<label for='chx9'>COL9</label>
</td>
</tr>
</tfoot>
</table>
</body>
</html>
Try this one.
I give table-fixed. and fixed with of TH.
The whole code is below;
.report-table {
border-collapse: collapse;
width: 100%;
font-family: Arial;
}
.report-table .col-name {
width: 150px;
}
.report-table .col-title {
width: 150px;
}
.report-table .col-carried {
width: 60px;
}
.report-table .col-earned {
width: 60px;
}
.report-table .col-used {
width: 60px;
}
.report-table .col-scheduled {
width: 60px;
}
.report-table .col-balance {
width: 60px;
}
.report-table .col-to-be {
width: 60px;
}
.report-table .col-available {
width: 60px;
}
.report-table .inner-table tr td{
border: 0;
}
.report-table.hr-table .inner-table {
background: none;
border: 0;
}
.report-table.hr-table .inner-table td {
vertical-align: top;
}
.report-table.hr-table tr {
border-top: 1px solid #333;
}
.report-table.hr-table td,
.report-table.hr-table th{
vertical-align: top;
text-align: left;
}
.report-table.hr-table .inner-table td:first-child {
padding-left: 0;
}
.col-title{width:100px !important}
table{table-layout:fixed;border-collapse:collapse}
table table{width:100%}
<table class="tablesorter hr-table hr-table-striped report-table">
<thead>
<tr>
<th class="header col-name">Name<span></span></th>
<th class="header col-title">Leave Title<span></span></th>
<th class="header col-carried">Carried Over<span></span></th>
<th class="header col-earned">Earned<span></span></th>
<th class="header col-used">Used <span></span></th>
<th class="header col-scheduled">Scheduled <span></span></th>
<th class="header col-balance">Balance<span></span></th>
<th class="header col-to-be">To-be-earned<span></span></th>
<th class="header col-available">Avaliable<span></span></th>
</tr>
</thead>
<tbody>
<tr>
<td class="col-name">Ethan Hunt</td>
<td colspan="8">
<table class=" hr-table inner-table">
<tr>
<td class="col-title">Vacation</td>
<td class="col-carried">10</td>
<td class="col-earned">20</td>
<td class="col-used">20</td>
<td class="col-scheduled">5</td>
<td class="col-balance">0</td>
<td class="col-to-be">10</td>
<td class="col-available">5</td>
</tr>
<tr>
<td class="col-title">Sickness</td>
<td class="col-carried">10</td>
<td class="col-earned">20</td>
<td class="col-used">20</td>
<td class="col-scheduled">5</td>
<td class="col-balance">0</td>
<td class="col-to-be">10</td>
<td class="col-available">5</td>
</tr>
<tr>
<td class="col-title">Training</td>
<td class="col-carried">10</td>
<td class="col-earned">20</td>
<td class="col-used">20</td>
<td class="col-scheduled">5</td>
<td class="col-balance">0</td>
<td class="col-to-be">10</td>
<td class="col-available">5</td>
</tr>
</table>
</td>
</tr>
<tr>
<td class="col-name">Lara Craft</td>
<td class="col-title">Training</td>
<td class="col-carried">10</td>
<td class="col-earned">20</td>
<td class="col-used">20</td>
<td class="col-scheduled">5</td>
<td class="col-balance">0</td>
<td class="col-to-be">10</td>
<td class="col-available">5</td>
</tr>
<tr>
<td class="col-name">Ethan Hunt</td>
<td colspan="8">
<table class=" hr-table inner-table">
<tr>
<td class="col-title">Vacation</td>
<td class="col-carried">10</td>
<td class="col-earned">20</td>
<td class="col-used">20</td>
<td class="col-scheduled">5</td>
<td class="col-balance">0</td>
<td class="col-to-be">10</td>
<td class="col-available">5</td>
</tr>
<tr>
<td class="col-title">Sickness</td>
<td class="col-carried">10</td>
<td class="col-earned">20</td>
<td class="col-used">20</td>
<td class="col-scheduled">5</td>
<td class="col-balance">0</td>
<td class="col-to-be">10</td>
<td class="col-available">5</td>
</tr>
<tr>
<td class="col-title">Training</td>
<td class="col-carried">10</td>
<td class="col-earned">20</td>
<td class="col-used">20</td>
<td class="col-scheduled">5</td>
<td class="col-balance">0</td>
<td class="col-to-be">10</td>
<td class="col-available">5</td>
</tr>
</table>
</td>
</tr>
</tbody>
</table>
Try this just set width for .inner-table td.
.report-table {
border-collapse: collapse;
width: 100%;
font-family: Arial;
}
.report-table .col-name {
width: 150px;
}
.report-table .col-title {
width: 150px;
}
.report-table .col-carried {
width: 60px;
}
.report-table .col-earned {
width: 60px;
}
.report-table .col-used {
width: 60px;
}
.report-table .col-scheduled {
width: 60px;
}
.report-table .col-balance {
width: 60px;
}
.report-table .col-to-be {
width: 60px;
}
.report-table .col-available {
width: 60px;
}
.report-table .inner-table tr td{
border: 0;
}
.report-table.hr-table .inner-table {
background: none;
border: 0;
}
.report-table.hr-table .inner-table td {
vertical-align: top;
}
.report-table.hr-table tr {
border-top: 1px solid #333;
}
.report-table.hr-table td,
.report-table.hr-table th{
padding: 10px;
vertical-align: top;
text-align: left;
}
.report-table.hr-table .inner-table td:first-child {
padding-left: 0;
width: 10%;
}
<table class="tablesorter hr-table hr-table-striped report-table">
<thead>
<tr>
<th class="header col-name">Name<span></span></th>
<th class="header col-title">Leave Title<span></span></th>
<th class="header col-carried">Carried Over<span></span></th>
<th class="header col-earned">Earned<span></span></th>
<th class="header col-used">Used <span></span></th>
<th class="header col-scheduled">Scheduled <span></span></th>
<th class="header col-balance">Balance<span></span></th>
<th class="header col-to-be">To-be-earned<span></span></th>
<th class="header col-available">Avaliable<span></span></th>
</tr>
</thead>
<tbody>
<tr>
<td class="col-name">Ethan Hunt</td>
<td colspan="8">
<table class=" hr-table inner-table">
<tr>
<td class="col-title">Vacation</td>
<td class="col-carried">10</td>
<td class="col-earned">20</td>
<td class="col-used">20</td>
<td class="col-scheduled">5</td>
<td class="col-balance">0</td>
<td class="col-to-be">10</td>
<td class="col-available">5</td>
</tr>
<tr>
<td class="col-title">Sickness</td>
<td class="col-carried">10</td>
<td class="col-earned">20</td>
<td class="col-used">20</td>
<td class="col-scheduled">5</td>
<td class="col-balance">0</td>
<td class="col-to-be">10</td>
<td class="col-available">5</td>
</tr>
<tr>
<td class="col-title">Training</td>
<td class="col-carried">10</td>
<td class="col-earned">20</td>
<td class="col-used">20</td>
<td class="col-scheduled">5</td>
<td class="col-balance">0</td>
<td class="col-to-be">10</td>
<td class="col-available">5</td>
</tr>
</table>
</td>
</tr>
<tr>
<td class="col-name">Lara Craft</td>
<td class="col-title">Training</td>
<td class="col-carried">10</td>
<td class="col-earned">20</td>
<td class="col-used">20</td>
<td class="col-scheduled">5</td>
<td class="col-balance">0</td>
<td class="col-to-be">10</td>
<td class="col-available">5</td>
</tr>
<tr>
<td class="col-name">Ethan Hunt</td>
<td colspan="8">
<table class=" hr-table inner-table">
<tr>
<td class="col-title">Vacation</td>
<td class="col-carried">10</td>
<td class="col-earned">20</td>
<td class="col-used">20</td>
<td class="col-scheduled">5</td>
<td class="col-balance">0</td>
<td class="col-to-be">10</td>
<td class="col-available">5</td>
</tr>
<tr>
<td class="col-title">Sickness</td>
<td class="col-carried">10</td>
<td class="col-earned">20</td>
<td class="col-used">20</td>
<td class="col-scheduled">5</td>
<td class="col-balance">0</td>
<td class="col-to-be">10</td>
<td class="col-available">5</td>
</tr>
<tr>
<td class="col-title">Training</td>
<td class="col-carried">10</td>
<td class="col-earned">20</td>
<td class="col-used">20</td>
<td class="col-scheduled">5</td>
<td class="col-balance">0</td>
<td class="col-to-be">10</td>
<td class="col-available">5</td>
</tr>
</table>
</td>
</tr>
</tbody>
</table>
Related
I want to give a spec table for the Watch 4. For now, I have this code.
<div class="specs">
<ul class="info">
<li>Lengte</li>
<li>44 mm</li>
</ul>
</div>
<div class="specs">
<ul class="info">
<li>Breedte</li>
<li>43.3 mm</li>
</ul>
</div>
with this CSS code
.specs{
position: relative;
top: 20px;
display: flex;
flex-direction: row;
align-items: center;
}
.info{
display: flex;
flex-direction: row;
color: black;
align-items: center;
margin-left: auto;
margin-right: auto;
border-bottom: 1px black solid;
padding: 0;
}
.info li{
display: flex;
flex-direction: row;
margin-right: 200px;
margin-left: 200px;
}
Here is the full project https://jsfiddle.net/2wvfyg16/
You might have to make the CSS tab bigger.
All the way at the bottom at the tab "Verbindungen".
It is all miss aligned.
As the data appears to be tabular, this snippet is a simple start on setting out the two columns with spacing in an HTML table.
Obviously you'll want to change things to give the exact layout your want but it does demonstrate that an HTML table can give the sort of formatting required.
#specs {
width: 100vw;
border-collapse: collapse;
}
#specs th {
font-size: 3em;
text-align: left;
padding-top: 1em;
}
#specs td {
width: 50%;
padding: 1em 5em;
}
#specs td {
font-size: 2em;
}
#specs tr:not(.cat) {
border-bottom: solid 1px black;
padding: 1em;
}
<table id="specs">
<tr class="cat">
<th colspan="2">Formaat</th>
</tr>
<tr>
<td>Lengte</td>
<td>44 mm</td>
<tr>
<td>Breedte</td>
<td>43.3 mm</td>
</tr>
<tr>
<td>Hoogte</td>
<td>9.8 mm</td>
</tr>
<tr>
<td>Gewicht</td>
<td>30 gram</td>
</tr>
<tr>
<td>Stofdicht</td>
<td>Ja</td>
</tr>
<tr>
<td>Spatwaterdicht</td>
<td>Ja</td>
</tr>
<tr>
<td>Waterdicht</td>
<td>Ja</td>
</tr>
<tr class="cat" colspan="2">
<th colspan="2">Display</th>
</tr>
<tr>
<td>Schermgrootte</td>
<td>40 & 44 mm</td>
</tr>
<tr>
<td>Schermtype</td>
<td>OLED</td>
</tr>
<tr class="cat" colspan="2">
<th colspan="2">Processor</th>
</tr>
<tr>
<td>Chipset</td>
<td>Samsung Exynos W920</td>
</tr>
<tr>
<td>Opslagcapaciteit</td>
<td>16 GB</td>
</tr>
<tr>
<td>Werkgeheugen</td>
<td>1500 MB</td>
</tr>
<tr class="cat" colspan="2">
<th colspan="2">Software</th>
</tr>
<tr>
<td>Besturingssysteem</td>
<td>One UI Watch</td>
</tr>
<tr class="cat" colspan="2">
<th colspan="2">Sensoren</th>
</tr>
<tr>
<td>Accelerometer</td>
<td>Jas</td>
</tr>
<tr>
<td>Hartslagmeter</td>
<td>Ja</td>
</tr>
<tr>
<td>Gyroscoop</td>
<td>Ja</td>
</tr>
<tr>
<td>GPS</td>
<td>Ja</td>
</tr>
<tr class="cat" colspan="2">
<th colspan="2">Batterij</th>
</tr>
<tr>
<td>Capaciteit</td>
<td>361 mAh</td>
</tr>
<tr>
<td>Vervangbaar</td>
<td>Nee</td>
</tr>
<tr class="cat" colspan="2">
<th colspan="2">Verbindingen</th>
</tr>
<tr>
<td>WiFi</td>
<td>Ja</td>
</tr>
<tr>
<td>Mobiel Netwerk</td>
<td>Nee</td>
</tr>
<tr>
<td>Bluetooth</td>
<td>Bluetooth 5.0</td>
</tr>
<tr>
<td>NFC</td>
<td>Ja</td>
</tr>
</table>
use justify items center i think it would work for that problem
I have table indentations controlled by padding. I set class="indent-(number_inches)" to choose indentation level. I am running into an issue where the <th> tags always indent based on the indent-18 class instead of the assigned class.
Whenever I remove the .indent-18 class from my CSS it takes on the properties of .indent-12 class instead.
Replacing th with th:first-child in css does not work
I am also open to any other, non-related critique on my code. I am still learning so teaching me the proper way would help a lot
/* TABLE CLASSES*/
.units {
text-align: left;
}
.table-header {
font-size: 20px;
text-align: center;
border-bottom: 2px solid black;
}
.big-header {
font-size: 16px;
}
.small-header {
font-size: 16px;
}
/*
Nest table based on these values
Indent 0" 6" 12" or 18", based off of excel indentations
*/
.indent-0 td:first-child,
th {
padding: 10px;
padding-left: 10px;
}
.indent-6 td:first-child,
th {
padding: 10px;
padding-left: 3%;
}
.indent-12 td:first-child,
th {
padding: 10px;
padding-left: 6%;
}
.indent-18 td:first-child,
th {
padding: 10px;
padding-left: 9%;
}
<link href="https://maxcdn.bootstrapcdn.com/bootstrap/4.0.0/css/bootstrap.min.css" rel="stylesheet">
<!-- USER FORM STARTS-->
<form action="/update_car_data/" method="post">
<div class="row">
<!-- TABLE 1 -->
<div class="col-md-6 col-sm-12 col-xs-12">
<table>
<thead>
<th class="table-header" colspan="3">Model Inputs, Internal Combustion Engine</th>
</thead>
<!--
Structure of table row:
Title | value | units
-->
<tr class="indent-0">
<td>Vehicle Life</td>
<td><input name="G18_Car" value="{{data['G18_Car']}}"></td>
<td class="units">Years</td>
</tr>
<tr class="indent-0">
<td>Distance Traveled Per Year After Purchase</td>
<td><input name="G19_Car" value="{{data['G19_Car']}}"></td>
<td class="units">Miles</td>
</tr>
<!--Generation, Assembly, and Delivery-->
<th class="big-header indent-0">Manufacture, Assembly, and Delivery</th>
<tr class="indent-6">
<td>Manufacture Assembly - GHG Emissions</td>
<td><input name="G22_Car" value="{{data['G22_Car']}}"></td>
<td class="units">MT CO2e</td>
</tr>
<tr class="indent-6">
<td>Delivery - GHG Emissions</td>
<td><input name="G23_Car" value="{{data['G23_Car']}}"></td>
<td class="units">MT CO2e</td>
</tr>
<!--Operation and Disposal-->
<tr>
<th class="big-header indent-0">Operation and Disposal</th>
</tr>
<!--Tailpipe emissions-->
<tr>
<th class="small-header indent-6">Tailpipe Emissions</th>
</tr>
<tr class="indent-12">
<td>Emissions Per Gallon of Gasoline</td>
<td><input name="G28_Car" value="{{data['G28_Car']}}"></td>
<td class="units">kg CO2e/gal</td>
</tr>
<tr class="indent-12">
<td>Fuel Efficiency</td>
<td><input name="G29_Car" value="{{data['G29_Car']}}"></td>
<td class="units">Miles/gal</td>
</tr>
<!--Fuel Cycle-->
<tr>
<th class="small-header indent-6">Fuel Cycle</th>
</tr>
<tr>
<th class="small-header indent-12">Ethanol Fuel Cycle</th>
</tr>
<tr class="indent-18">
<td>Volume % of Ethanol</td>
<td><input name="G23_Car" value="{{data['G32_Car']}}"></td>
<td class="units">%</td>
</tr>
<tr class="indent-18">
<td>Ethanol Fuel Cycle Basis</td>
<td><input name="G44_Car" value="{{data['G44_Car']}}"></td>
<td class="units">kg CO2e/gal</td>
</tr>
<tr>
<th class="small-header indent-12">Petroleum (Gasoline) Fuel Cycle</th>
</tr>
<tr class="indent-18">
<td>Upstream (Well to Refining Emissions)</td>
<td><input name="G33_Car" value="{{data['G33_Car']}}"></td>
<td class="units">MT CO2e/BBL-crude</td>
</tr>
<!--Refining-->
<tr>
<th class="small-header indent-18">Refining</th>
</tr>
<tr class="indent-18">
<td>Processing (Volumetric) Gain</td>
<td><input name="G36_Car" value="{{data['G36_Car']}}"></td>
<td class="units">%</td>
</tr>
<tr class="indent-18">
<td>Refining GHG Emissions Basis</td>
<td><input name="G37_Car" value="{{data['G37_Car']}}"></td>
<td class="units">MT CO2e/BBL-crude</td>
</tr>
<!--Distrubition (Refining to sales)-->
<tr>
<th class="small-header indent-12">Distrubition (Refining to Sales)</th>
</tr>
<tr class="child-row indent-18">
<td>Evaporative Loss</td>
<td><input name="G40_Car" value="{{data['G40_Car']}}"></td>
<td class="units">%</td>
</tr>
<tr class="indent-18">
<td>Carbon Intensity (GWP 100) of Motor Gasoline</td>
<td><input name="G41_Car" value="{{data['G41_Car']}}"></td>
<td class="units">MT CO2e/MT</td>
</tr>
<tr class="indent-18">
<td>Tank-Truck Shipment to Sales Centers</td>
<td><input name="G42_Car" value="{{data['G42_Car']}}"></td>
<td class="units">MT CO2e/year</td>
</tr>
<tr class="indent-0">
<td>Disposal -GHG Emissions</td>
<td><input name="G46_Car" value="{{data['G46_Car']}}"></td>
<td class="units">MT CO2e</td>
</tr>
</table>
</div>
<!-- TABLE 2 -->
<div class="col-md-6 col-sm-12 col-xs-12">
<table>
<tr>
<th class="table-header" colspan="3">Model Inputs, EV (Electric Vehicle)</th>
</tr>
<tr class="child-row">
<td>Vehicle Life</td>
<td><input name="G18_Car" value="{{data['G18_Car']}}"></td>
<td>Years</td>
</tr>
<tr class="child-row">
<td>Delivery -GHG emissions</td>
<td><input name="G19_Car" value="{{data['G19_Car']}}"></td>
<td>Miles</td>
</tr>
</table>
</div>
<br>
<div class="col-12">
<button name="updateBtn" type="submit">Update</button>
</div>
</div>
</form>
You should change the CSS like this :
.indent-0 td:first-child, th.indent-0 {
padding: 10px;
padding-left: 10px;
}
.indent-6 td:first-child, th.indent-6 {
padding: 10px;
padding-left: 3%;
}
.indent-12 td:first-child, th.indent-12 {
padding: 10px;
padding-left: 6%;
}
.indent-18 td:first-child, th.indent-18 {
padding: 10px;
padding-left: 9%;
}
Fiddle
"A selector's weighting is evaluated based on the components that make it up, with id's given a weighting of 100, classes with a weighting of 10, and element selectors with weighting of 1."
According to this th should weight 1 while tr:nth-child(2n+1) should weigh 11 due to pseudo class. but the background color of th is used when displayed in the browser. Can you explain why ?
table {
margin-left: 20px;
margin-right: 20px;
border: thin solid black;
caption-side: bottom;
border-collapse: collapse;
}
td,
th {
border: thin dotted gray;
padding: 5px;
}
caption {
font-style: italic;
padding-top: 8px;
}
td.center,
th.center {
text-align: center;
}
td.right,
th.right {
text-align: right;
}
th {
background-color: #cc6600;
}
tr:nth-child(2n+1) {
background-color: #fcba7a;
}
<table>
<caption>The cities I visited on my Segway'n USA travels</caption>
<tr>
<th>City</th>
<th class="center">Date</th>
<th class="center">Temprature</th>
<th class="right">Altitude</th>
<th class="right">Population</th>
<th class="center">Dinner Rating</th>
</tr>
<tr>
<td>Walla Walla, WA</td>
<td class="center">June 15th</td>
<td class="center">78</td>
<td class="right">1,204 ft</td>
<td class="right">29,686</td>
<td class="center">4/5</td>
</tr>
<tr class="cellcolor">
<td>Magic City, ID</td>
<td class="center">June 25th</td>
<td class="center">74</td>
<td class="right">5,312 ft</td>
<td class="right">50</td>
<td class="center">3/5</td>
</tr>
<tr>
<td>Bountiful, UT</td>
<td class="center">July 10th</td>
<td class="center">91</td>
<td class="right">4,226 ft</td>
<td class="right">41,173</td>
<td class="center">4/5</td>
</tr>
<tr class="cellcolor">
<td>Last Chance, CO</td>
<td class="center">July 23rd</td>
<td class="center">102</td>
<td class="right">4,780 ft</td>
<td class="right">256</td>
<td class="center">3/5</td>
</tr>
<tr>
<td>Truth Or Consequences, NM</td>
<td class="center">August 9th</td>
<td class="center">93</td>
<td class="right">4,242 ft</td>
<td class="right">7,289</td>
<td class="center">5/5</td>
</tr>
<tr class="cellcolor">
<td>Why, AZ</td>
<td class="center">August 18th</td>
<td class="center">104</td>
<td class="right">860 ft</td>
<td class="right">480</td>
<td class="center">3/5</td>
</tr>
</table>
th and tr are two different elements, so it wouldn't effect each other.
This isn't an issue of specificity. You are dealing with two different selectors.
The first selector targets table rows.
tr:nth-child(2n+1) {
background-color: #fcba7a;
}
The other selector targets table headings.
th {
background-color: #cc6600;
}
If you want to actually measure specificity, then have them target the same elements:
tr:nth-child(2n+1) > th {
background-color: #fcba7a;
}
th {
background-color: #cc6600;
}
table {
margin-left: 20px;
margin-right: 20px;
border: thin solid black;
caption-side: bottom;
border-collapse: collapse;
}
td,
th {
border: thin dotted gray;
padding: 5px;
}
caption {
font-style: italic;
padding-top: 8px;
}
td.center,
th.center {
text-align: center;
}
td.right,
th.right {
text-align: right;
}
th {
background-color: #cc6600;
}
tr:nth-child(2n+1) > th {
background-color: #fcba7a;
}
<table>
<caption>The cities I visited on my Segway'n USA travels</caption>
<tr>
<th>City</th>
<th class="center">Date</th>
<th class="center">Temprature</th>
<th class="right">Altitude</th>
<th class="right">Population</th>
<th class="center">Dinner Rating</th>
</tr>
<tr>
<td>Walla Walla, WA</td>
<td class="center">June 15th</td>
<td class="center">78</td>
<td class="right">1,204 ft</td>
<td class="right">29,686</td>
<td class="center">4/5</td>
</tr>
<tr class="cellcolor">
<td>Magic City, ID</td>
<td class="center">June 25th</td>
<td class="center">74</td>
<td class="right">5,312 ft</td>
<td class="right">50</td>
<td class="center">3/5</td>
</tr>
<tr>
<td>Bountiful, UT</td>
<td class="center">July 10th</td>
<td class="center">91</td>
<td class="right">4,226 ft</td>
<td class="right">41,173</td>
<td class="center">4/5</td>
</tr>
<tr class="cellcolor">
<td>Last Chance, CO</td>
<td class="center">July 23rd</td>
<td class="center">102</td>
<td class="right">4,780 ft</td>
<td class="right">256</td>
<td class="center">3/5</td>
</tr>
<tr>
<td>Truth Or Consequences, NM</td>
<td class="center">August 9th</td>
<td class="center">93</td>
<td class="right">4,242 ft</td>
<td class="right">7,289</td>
<td class="center">5/5</td>
</tr>
<tr class="cellcolor">
<td>Why, AZ</td>
<td class="center">August 18th</td>
<td class="center">104</td>
<td class="right">860 ft</td>
<td class="right">480</td>
<td class="center">3/5</td>
</tr>
</table>
I am trying to align the images to the top of the row in this table:
<table class="customers">
<thead>
<tr>
<th class="first">
How can I get the images aligned to the top of the row?
</th>
<th class="second"></th>
<th class="third"></th>
<th class="fourth ng-binding">Mary</th>
<th ng-class="persons.length>1 ? 'fifth' : (persons.length<2 ? 'fifth_single' : '') " class="ng-binding fifth">
</th>
</tr>
</thead>
<tbody>
<tr ng-class="'odd'" class="odd border_bottom">
<td>
<table class="docInfo">
<tbody>
<tr>
<td rowspan="2" ng-show="showDocInfo(1,strategy.statuses[0].reason)" ng-click="showTextArea(1)"
class="ng-hide"><img src="http://cdn.mysitemyway.com/etc-mysitemyway/icons/legacy-previews/icons-256/3d-transparent-glass-icons-business/076004-3d-transparent-glass-icon-business-document4.png" alt="docimage"></td>
<td ng-show="showDocInfo(1,strategy.statuses[0].reason)" class="ng-binding ng-hide">Mary</td>
</tr>
<tr>
<td ng-show="showDocInfo(1,strategy.statuses[0].reason)" class="ng-hide"><span><p
class="ng-binding">Mar
4, 2015 2:42:25 PM</p></span></td>
</tr>
</tbody>
</table>
<table class="docInfo">
<tbody>
<tr>
<td rowspan="2" ng-show="showDocInfo(1,strategy.statuses[0].reason)" ng-click="showTextArea(1)"
class="ng-hide"><img src="http://cdn.mysitemyway.com/etc-mysitemyway/icons/legacy-previews/icons-256/3d-transparent-glass-icons-business/076004-3d-transparent-glass-icon-business-document4.png" alt="docimage"></td>
<td ng-show="showDocInfo(1,strategy.statuses[0].reason)" class="ng-binding ng-hide">Mary</td>
</tr>
<tr>
<td ng-show="showDocInfo(1,strategy.statuses[0].reason)" class="ng-hide"><span><p
class="ng-binding">Mar
4, 2015 2:42:25 PM</p></span></td>
</tr>
</tbody>
</table>
</td>
</tr>
<tr ng-class="'odd'" class="odd borderbottom">
<td>
<table class="docInfo">
<tbody>
<tr>
<td rowspan="2" ng-show="showDocInfo(1,strategy.statuses[0].reason)" ng-click="showTextArea(1)"
class="ng-hide"><img src="http://cdn.mysitemyway.com/etc-mysitemyway/icons/legacy-previews/icons-256/3d-transparent-glass-icons-business/076004-3d-transparent-glass-icon-business-document4.png" alt="docimage"></td>
<td ng-show="showDocInfo(1,strategy.statuses[0].reason)" class="ng-binding ng-hide">Mary</td>
</tr>
<tr>
<td ng-show="showDocInfo(1,strategy.statuses[0].reason)" class="ng-hide"><span><p
class="ng-binding">Mar
4, 2015 2:42:25 PM</p></span></td>
</tr>
</tbody>
</table>
<table class="docInfo">
<tbody>
<tr>
<td rowspan="2" ng-show="showDocInfo(1,strategy.statuses[0].reason)" ng-click="showTextArea(1)"
class="ng-hide"><img src="http://cdn.mysitemyway.com/etc-mysitemyway/icons/legacy-previews/icons-256/3d-transparent-glass-icons-business/076004-3d-transparent-glass-icon-business-document4.png" alt="docimage"></td>
<td ng-show="showDocInfo(1,strategy.statuses[0].reason)" class="ng-binding ng-hide">Mary</td>
</tr>
<tr>
<td ng-show="showDocInfo(1,strategy.statuses[0].reason)" class="ng-hide"><span><p
class="ng-binding">Mar
4, 2015 2:42:25 PM</p></span></td>
</tr>
</tbody>
</table>
</td>
</tr>
<tr ng-class="'even'" class="even">
<td></td>
<td></td>
<td></td>
<td></td>
<td>
</td>
</tr>
<tr ng-class="'odd'" class="odd">
<td></td>
<td></td>
<td></td>
<td></td>
<td>
</td>
</tr>
<tr ng-class="'even'" class="even">
<td></td>
<td></td>
<td></td>
<td>
</td>
<td>
</td>
</tr>
</tbody>
</table>
At the moment the images are sort of in the middle of each row. How can I get them aligned to the top of the row? I tried to set the verticalalign property but did not fix it.
Here is the stylesheet:
.customers
{
table-layout: fixed;
border: in 2px;
float: left;
}
img
{
height:30px;}
.customers tr.border_bottom > td {
border-bottom:1pt solid black;
}
.customers td {
margin: 0 5px;
padding: 10px 8px;
line-height: 1.4;
vertical-align: middle;
}
td {
vertical-align: top;
}
.customers .first {
width: 40%;
}
.customers .first_single {
width: 39%;
}
.customers .second {
width: 20%;
}
.customers .third {
width: 20%;
}
.customers .fourth {
width: 20%;
}
.customers .fifth{
width: 20%;
}
.customers .fifth_single{
width: 1%;
}
tr.odd>td,tr.even>td{
width:100%;
}
.docInfo {
table-layout: fixed;
float: left;
}
.docInfo td {
margin: 0 5px;
padding: 0px 5px;
line-height: 0.2;
font-size: 10px;
vertical-align: top;
font-family: Arial;
font-weight: bold;
}
.first {
width: 40%;
}
.second {
width: 60%
}
img {
background: transparent;
height: 25px;
}
}
Also created a plunkr url:http://plnkr.co/edit/CssSPt?p=preview
I think your problem is the
line-height: 0.2;
style that is applied to the .docInfo td
It is not a large enough line-height for the text and so is causing mis-alignment of your table.
Take this style off and the alignment of the image moves to the top.
If you need this line-height for your text, apply it to the paragraph instead of the table cell.
JSFiddle
I tried every way I could think of to clear this gap but still without success. I also tried to set padding = 0 but the gap's still there too. If i zoom out, the gap will disapper, can't figure out why!
This is the css for the last td tag (the blue rows which creates the gap) :
.tdtieudecuoi{
text-align:left;
background-color: #80A5CE;
color: #FFF;
font-weight: bold;
padding:0;
}
In your thkqgiai element add the border-top attribute as follows...
.thkqgiai{
width:20% !important;
text-align:center;
color:white;
background-color: #910000;
border-top:1px solid #910000;
}
And in the TD attributes add the following to border attributes...
border-bottom:1px solid #80A5CE;
border-right:1px solid #80A5CE;
Instead of line-height you can use height:
body {
padding: 0;
}
table,
th,
td,
tr {
border-collapse: collapse;
}
.tb {
width: 500px;
}
.tb td {
/*line-height: 25px;remove line height*/
font-size: 13px;
font-weight: bold;
font-family: Arial, Helvetica, sans-serif;
padding: 0;
height: 25px;/*add height*/
}
.tb th {
padding: 5px;/*increase padding to 5px*/
}
/*2 cell đầu tiên, xác định độ rộng*/
.tdkq,
.tddd {
padding: 0;
}
.tdkq {
width: 70%;
vertical-align: top;
}
.tddd {
width: 30%;
vertical-align: top;
}
/*bảng kết quả và đầu đuôi*/
.tbkq {
width: 100%;
word-wrap: break-word;
table-layout: fixed;
float: left;
margin-bottom: 0;
padding-bottom: 0;
border-right: 1px solid #CCC;
}
.tbdd {
width: 100%;
}
.tbdd td {
border-top: 1px solid #CCC;
border-bottom: 1px solid #CCC;
border-left: 1px solid #CCC;
border-right: 1px solid #CCC;
}
/*cột giải và kết quả của bảng kết quả*/
.trkq {
width: 100%;
}
.thkqgiai {
width: 20% !important;
text-align: center;
color: white;
background-color: #910000;
}
.thkqso {
width: 80% !important;
color: #CC3F51;
font-weight: bold;
font-size: 16px;
text-align: center !important;
background-color: #FFF;
}
.tdkqgiai {
text-align: center;
background-color: #F9F9F9;
color: #910000;
}
.tdkqgiaidb {
text-align: center;
color: white;
background-color: #910000;
}
.tdkqso {
text-align: center;
word-wrap: break-word !important;
border-top: 1px solid #CCC;
}
.tdkqsodb {
text-align: center;
word-wrap: break-word !important;
color: red;
border-top: 1px solid #CCC;
}
/*cột đầu và đuôi của bảng đầu đuôi*/
.thdddau {
width: 30%;
color: white;
background-color: #910000;
}
.thddduoi {
width: 70%;
color: white;
background-color: #910000;
}
/*tiêu đề cho bảng kq*/
.tieudemien {
line-height: 24px;
background-color: #80A5CE;
text-transform: uppercase;
color: #FFF;
font-weight: bold;
font-size: 12px;
width: 500px;
margin-bottom: 0;
padding-bottom: 0;
}
.tdtieudecuoi {
text-align: left;
background-color: #80A5CE;
color: #FFF;
font-weight: bold;
padding: 0;
}
<div id="body_content">
<br />
<h2 class="tieudemien"> Kết quả xổ số Miền Nam ngày 02-11-2014 (Chủ nhật)</h2>
<table class="tb">
<tbody>
<tr>
<td class="tdkq">
<table class="tbkq">
<tbody>
<tr class="trkq">
<th class="thkqgiai">Giải</th>
<th class="thkqso">Kiên Giang</th>
</tr>
<tr>
<td class="tdkqgiai">Đặc biệt</td>
<td class="tdkqsodb">048674</td>
</tr>
<tr>
<td class="tdkqgiai">Giải nhất</td>
<td class="tdkqso">38463</td>
</tr>
<tr>
<td class="tdkqgiai">Giải nhì</td>
<td class="tdkqso">37309</td>
</tr>
<tr>
<td class="tdkqgiai">Giải ba</td>
<td class="tdkqso">20091-22416</td>
</tr>
<tr>
<td class="tdkqgiai">Giải bốn</td>
<td class="tdkqso">28539-63139-58063-48935-41701-02723-41398</td>
</tr>
<tr>
<td class="tdkqgiai">Giải năm</td>
<td class="tdkqso">1102</td>
</tr>
<tr>
<td class="tdkqgiai">Giải sáu</td>
<td class="tdkqso">5373-2976-4875</td>
</tr>
<tr>
<td class="tdkqgiai">Giải bảy</td>
<td class="tdkqso">551</td>
</tr>
<tr>
<td class="tdkqgiai">Giải tám</td>
<td class="tdkqso">50</td>
</tr>
<tr>
<td class="tdtieudecuoi"></td>
<td class="tdtieudecuoi">Xem kết quả trực tiếp tại iKetqua.net</td>
</tr>
</tbody>
</table>
</td>
<td class="tddd">
<table class="tbdd">
<tbody>
<tr class="trkq">
<th class="thdddau">Đầu</th>
<th class="thddduoi">Đuôi</th>
</tr>
<tr>
<td class="tdkqgiai">0</td>
<td class="tdkqso">9,1,2</td>
</tr>
<tr>
<td class="tdkqgiai">1</td>
<td class="tdkqso">6</td>
</tr>
<tr>
<td class="tdkqgiai">2</td>
<td class="tdkqso">3</td>
</tr>
<tr>
<td class="tdkqgiai">3</td>
<td class="tdkqso">9,9,5</td>
</tr>
<tr>
<td class="tdkqgiai">4</td>
<td class="tdkqso"></td>
</tr>
<tr>
<td class="tdkqgiai">5</td>
<td class="tdkqso">1,0</td>
</tr>
<tr>
<td class="tdkqgiai">6</td>
<td class="tdkqso">3,3</td>
</tr>
<tr>
<td class="tdkqgiai">7</td>
<td class="tdkqso">4,3,6,5</td>
</tr>
<tr>
<td class="tdkqgiai">8</td>
<td class="tdkqso"></td>
</tr>
<tr>
<td class="tdkqgiai">9</td>
<td class="tdkqso">1,8</td>
</tr>
</tbody>
</table>
</td>
</tr>
</tbody>
</table>
<table class="tb">
<tbody>
<tr>
<td class="tdkq">
<table class="tbkq">
<tbody>
<tr class="trkq">
<th class="thkqgiai">Giải</th>
<th class="thkqso">Lâm Đồng</th>
</tr>
<tr>
<td class="tdkqgiai">Đặc biệt</td>
<td class="tdkqsodb">090431</td>
</tr>
<tr>
<td class="tdkqgiai">Giải nhất</td>
<td class="tdkqso">54958</td>
</tr>
<tr>
<td class="tdkqgiai">Giải nhì</td>
<td class="tdkqso">64035</td>
</tr>
<tr>
<td class="tdkqgiai">Giải ba</td>
<td class="tdkqso">24934-62958</td>
</tr>
<tr>
<td class="tdkqgiai">Giải bốn</td>
<td class="tdkqso">93752-22930-27309-04977-91008-21818-94007</td>
</tr>
<tr>
<td class="tdkqgiai">Giải năm</td>
<td class="tdkqso">2336</td>
</tr>
<tr>
<td class="tdkqgiai">Giải sáu</td>
<td class="tdkqso">0075-8638-4023</td>
</tr>
<tr>
<td class="tdkqgiai">Giải bảy</td>
<td class="tdkqso">204</td>
</tr>
<tr>
<td class="tdkqgiai">Giải tám</td>
<td class="tdkqso">61</td>
</tr>
<tr>
<td class="tdtieudecuoi"></td>
<td class="tdtieudecuoi">Xem kết quả trực tiếp tại iKetqua.net</td>
</tr>
</tbody>
</table>
</td>
<td class="tddd">
<table class="tbdd">
<tbody>
<tr class="trkq">
<th class="thdddau">Đầu</th>
<th class="thddduoi">Đuôi</th>
</tr>
<tr>
<td class="tdkqgiai">0</td>
<td class="tdkqso">9,8,7,4</td>
</tr>
<tr>
<td class="tdkqgiai">1</td>
<td class="tdkqso">8</td>
</tr>
<tr>
<td class="tdkqgiai">2</td>
<td class="tdkqso">3</td>
</tr>
<tr>
<td class="tdkqgiai">3</td>
<td class="tdkqso">1,5,4,0,6,8</td>
</tr>
<tr>
<td class="tdkqgiai">4</td>
<td class="tdkqso"></td>
</tr>
<tr>
<td class="tdkqgiai">5</td>
<td class="tdkqso">8,8,2</td>
</tr>
<tr>
<td class="tdkqgiai">6</td>
<td class="tdkqso">1</td>
</tr>
<tr>
<td class="tdkqgiai">7</td>
<td class="tdkqso">7,5</td>
</tr>
<tr>
<td class="tdkqgiai">8</td>
<td class="tdkqso"></td>
</tr>
<tr>
<td class="tdkqgiai">9</td>
<td class="tdkqso"></td>
</tr>
</tbody>
</table>
</td>
</tr>
</tbody>
</table>
<table class="tb">
<tbody>
<tr>
<td class="tdkq">
<table class="tbkq">
<tbody>
<tr class="trkq">
<th class="thkqgiai">Giải</th>
<th class="thkqso">Tiền Giang</th>
</tr>
<tr>
<td class="tdkqgiai">Đặc biệt</td>
<td class="tdkqsodb">545150</td>
</tr>
<tr>
<td class="tdkqgiai">Giải nhất</td>
<td class="tdkqso">78387</td>
</tr>
<tr>
<td class="tdkqgiai">Giải nhì</td>
<td class="tdkqso">06256</td>
</tr>
<tr>
<td class="tdkqgiai">Giải ba</td>
<td class="tdkqso">39415-15189</td>
</tr>
<tr>
<td class="tdkqgiai">Giải bốn</td>
<td class="tdkqso">90260-01471-58016-40732-68891-50834-93561</td>
</tr>
<tr>
<td class="tdkqgiai">Giải năm</td>
<td class="tdkqso">3390</td>
</tr>
<tr>
<td class="tdkqgiai">Giải sáu</td>
<td class="tdkqso">1556-3656-4176</td>
</tr>
<tr>
<td class="tdkqgiai">Giải bảy</td>
<td class="tdkqso">016</td>
</tr>
<tr>
<td class="tdkqgiai">Giải tám</td>
<td class="tdkqso">23</td>
</tr>
<tr>
<td class="tdtieudecuoi"></td>
<td class="tdtieudecuoi">Xem kết quả trực tiếp tại iKetqua.net</td>
</tr>
</tbody>
</table>
</td>
<td class="tddd">
<table class="tbdd">
<tbody>
<tr class="trkq">
<th class="thdddau">Đầu</th>
<th class="thddduoi">Đuôi</th>
</tr>
<tr>
<td class="tdkqgiai">0</td>
<td class="tdkqso"></td>
</tr>
<tr>
<td class="tdkqgiai">1</td>
<td class="tdkqso">5,6,6</td>
</tr>
<tr>
<td class="tdkqgiai">2</td>
<td class="tdkqso">3</td>
</tr>
<tr>
<td class="tdkqgiai">3</td>
<td class="tdkqso">2,4</td>
</tr>
<tr>
<td class="tdkqgiai">4</td>
<td class="tdkqso"></td>
</tr>
<tr>
<td class="tdkqgiai">5</td>
<td class="tdkqso">0,6,6,6</td>
</tr>
<tr>
<td class="tdkqgiai">6</td>
<td class="tdkqso">0,1</td>
</tr>
<tr>
<td class="tdkqgiai">7</td>
<td class="tdkqso">1,6</td>
</tr>
<tr>
<td class="tdkqgiai">8</td>
<td class="tdkqso">7,9</td>
</tr>
<tr>
<td class="tdkqgiai">9</td>
<td class="tdkqso">1,0</td>
</tr>
</tbody>
</table>
</td>
</tr>
</tbody>
</table>
</div>
Check my comments in css.
This is a rounding anomaly. It is a bad idea to use an inner table. You should use one big table instead, something like this:
.datatable {
border-collapse: collapse;
}
.datatable td {
border: 1px solid #CCCCCC;
font-weight: bold;
line-height: 25px;
padding: 3px;
}
.datatable .noborder {
border: hidden;
}
.datatable .titlecell {
color: #FFFFFF;
background-color: #80A5CE;
}
.datatable .subtitlehead {
background-color: #910000;
}
.datatable .subtitlecell {
color: #CE4859;
}
.datatable .maincolcell {
color: #910000;
}
.datatable .red {
color: #FF0000;
}
<table class="datatable">
<tr>
<td colspan="4" class="titlecell noborder">Kết quả xổ số Miền Nam ngày 02-11-2014 (Chủ nhật)</td>
</tr>
<tr>
<td class="subtitlehead">Giải</td>
<td class="subtitlecell">Kiên Giang</td>
<td class="subtitlehead">Đầu</td>
<td class="subtitlehead">Đuôi</td>
</tr>
<tr>
<td class="maincolcell">Đặc biệt</td>
<td class="red">048674</td>
<td class="maincolcell">0</td>
<td>9,1,2</td>
</tr>
<tr>
<td class="maincolcell">Giải nhất</td>
<td>38463</td>
<td class="maincolcell">1</td>
<td>6</td>
</tr>
<tr>
<td class="maincolcell">Giải nhì</td>
<td>37309</td>
<td class="maincolcell">2</td>
<td>3</td>
</tr>
<tr>
<td class="maincolcell">Giải ba</td>
<td>20091-22416</td>
<td class="maincolcell">3</td>
<td>9,9,5</td>
</tr>
<tr>
<td class="maincolcell">Giải bốn</td>
<td>28539-63139-58063-48935-41701-02723-41398</td>
<td class="maincolcell">4</td>
<td></td>
</tr>
<tr>
<td class="maincolcell">Giải năm</td>
<td>1102</td>
<td class="maincolcell">5</td>
<td>1,0</td>
</tr>
<tr>
<td class="maincolcell">Giải sáu</td>
<td>5373-2976-4875</td>
<td class="maincolcell">6</td>
<td>3,3</td>
</tr>
<tr>
<td class="maincolcell">Giải bảy</td>
<td>551</td>
<td class="maincolcell">7</td>
<td>4,3,6,5</td>
</tr>
<tr>
<td class="maincolcell">Giải tám</td>
<td>50</td>
<td class="maincolcell">8</td>
<td></td>
</tr>
<tr>
<td class="titlecell noborder"></td>
<td class="titlecell noborder">Xem kết quả trực tiếp tại iKetqua.net</td>
<td class="maincolcell">9</td>
<td>1,8</td>
</tr>
<tr>
<td class="subtitlehead">Giải</td>
<td class="subtitlecell">Lâm Đồng</td>
<td class="subtitlehead">Đầu</td>
<td class="subtitlehead">Đuôi</td>
</tr>
<tr>
<td colspan="4">and so on…</td>
</tr>
</table>