How to split a table row into two column? - html

I have a table with three column. But i need 9th row and 1st & 3rd column will split into 2 column. I have some stackoverflow answer but these are not solved my issue. I want something like below picture last row:
JSFIDDLE HERE.
.tg {
border-collapse: collapse;
border-spacing: 0;
margin: 0px auto;
}
.tg td {
font-family: Arial, sans-serif;
font-size: 14px;
padding: 12px 85px;
border-style: solid;
border-width: 1px;
overflow: hidden;
word-break: normal;
border-color: black;
}
.tg th {
font-family: Arial, sans-serif;
font-size: 14px;
font-weight: normal;
padding: 12px 85px;
border-style: solid;
border-width: 1px;
overflow: hidden;
word-break: normal;
border-color: black;
}
.tg .tg-0pky {
border-color: inherit;
text-align: left;
vertical-align: top
}
<table class="tg">
<tr>
<th class="tg-0pky">Applicants</th>
<th class="tg-0pky"></th>
<th class="tg-0pky">Joint Applicants</th>
</tr>
<tr>
<td class="tg-0pky"></td>
<td class="tg-0pky">Current last name or single name</td>
<td class="tg-0pky"></td>
</tr>
<tr>
<td class="tg-0pky"></td>
<td class="tg-0pky">First and middle names</td>
<td class="tg-0pky"></td>
</tr>
<tr>
<td class="tg-0pky"></td>
<td class="tg-0pky">Marital Status</td>
<td class="tg-0pky"></td>
</tr>
<tr>
<td class="tg-0pky">Country of divorce</td>
<td class="tg-0pky" rowspan="3">If divorced</td>
<td class="tg-0pky">Country of divorce</td>
</tr>
<tr>
<td class="tg-0pky">City of divorce if in Canada</td>
<td class="tg-0pky">City of divorce if in Canada</td>
</tr>
<tr>
<td class="tg-0pky">Court file number</td>
<td class="tg-0pky" colspan="2">Court file number</td>
</tr>
<tr>
<td class="tg-0pky"></td>
<td class="tg-0pky">Religious denomination</td>
<td class="tg-0pky"></td>
</tr>
<tr>
<td class="tg-0pky"></td>
<td class="tg-0pky">Age and date of birth</td>
<td class="tg-0pky"></td>
</tr>
<tr>
<td class="tg-0pky"></td>
<td class="tg-0pky">Place of birth</td>
<td class="tg-0pky"></td>
</tr>
</table>

The short answer is: You can't split individual cells into more cells unless you do that in all other rows too. Those other rows could then implement colspan=2 attribute on places where you want to merge 2 cells into a single cell to get the desired effect.
But the issue here is that you should not use the table at all and I strongly discourage you to do so. Table should be used only for tabular data. For layouts you should be using flexbox, or grid systems found in Bootstrap and similar CSS frameworks or anything else which is relying on CSS. I can't stress enough how important this is. There are dozens of reasons not to use it among accessibility, usability, semantic, SEO etc. Please read more here: Why not use tables for layout in HTML?

try this
<!-- Head -->
<tr>
<th class="tg-0pky" colspan="2">Applicants</th>
<th class="tg-0pky"></th>
<th class="tg-0pky" colspan="2">Joint Applicants</th>
</tr>
<!-- 1 -->
<tr>
<td class="tg-0pky" colspan="2"></td>
<td class="tg-0pky">Current last name or single name</td>
<td class="tg-0pky" colspan="2"></td>
</tr>
<!-- 2 -->
<tr>
<td class="tg-0pky" colspan="2"></td>
<td class="tg-0pky">First and middle names</td>
<td class="tg-0pky" colspan="2"></td>
</tr>
<!-- 3 -->
<tr>
<td class="tg-0pky" colspan="2"></td>
<td class="tg-0pky">Marital Status</td>
<td class="tg-0pky" colspan="2"></td>
</tr>
<!-- 4 -->
<tr>
<td class="tg-0pky" colspan="2">Country of divorce</td>
<td class="tg-0pky" rowspan="3">If divorced</td>
<td class="tg-0pky" colspan="2">Country of divorce</td>
</tr>
<!-- 5 -->
<tr>
<td class="tg-0pky" colspan="2">City of divorce if in Canada</td>
<td class="tg-0pky" colspan="2">City of divorce if in Canada</td>
</tr>
<!-- 6 -->
<tr>
<td class="tg-0pky" colspan="2">Court file number</td>
<td class="tg-0pky" colspan="2">Court file number</td>
</tr>
<!-- 7 -->
<tr>
<td class="tg-0pky" colspan="2"></td>
<td class="tg-0pky">Religious denomination</td>
<td class="tg-0pky" colspan="2"></td>
</tr>
<!-- 8 -->
<tr>
<td class="tg-0pky" colspan="2"></td>
<td class="tg-0pky">Age and date of birth</td>
<td class="tg-0pky" colspan="2"></td>
</tr>
<!-- 9 -->
<tr>
<td class="tg-0pky"></td>
<td class="tg-0pky"></td>
<td class="tg-0pky">Place of birth</td>
<td class="tg-0pky"></td>
<td class="tg-0pky"></td>
</tr>
</table>

Related

Keep the table width same and column width based on header width

I have a table which loads the data by crating all the elements inside the table dynamically. Something similar to datatable. Now, every time I regenerate the tbody for the next page, the column width changes based on text length and it changes the table width. I tried table-layout: fixed and td {width: 1%} but they don't work. I want to keep the table column width same as the header text width. How can I achieve that?
let tbody1 = document.getElementById('t-body-1')
let tbody2 = document.getElementById('t-body-2')
setInterval(function () {
tbody1.classList.toggle('no-display');
tbody2.classList.toggle('no-display');
}, 1000)
table {
border-collapse: collapse;
-webkit-box-shadow: #e2e2e2 0 10px 20px;
-moz-box-shadow: #e2e2e2 0 10px 20px;
box-shadow: #e2e2e2 0 10px 20px;
border-radius: 10px;
overflow: hidden;
/*table-layout: fixed;*/
/*width: 934px;*/
}
.r-thead-tr-th, .r-tbody-tr-td, .r-tfoot-tr-th {
padding: 12px 25px;
text-align: left;
/*width: 1%;*/
overflow: hidden;
border-collapse: collapse;
}
.no-display {
display:none;
}
<div class="table-container" id="table-container">
<div class="r-header-controller"></div>
<table id="custom-table">
<thead class="r-thead">
<tr class="r-thead-tr">
<th class="r-thead-tr-th">Name</th>
<th class="r-thead-tr-th">Designation</th>
<th class="r-thead-tr-th">City</th>
<th class="r-thead-tr-th">Postal</th>
<th class="r-thead-tr-th">Start date</th>
<th class="r-thead-tr-th">Salary</th>
</tr>
</thead>
<tbody id="t-body-1" class="r-tbody">
<tr class="r-tbody-tr">
<td class="r-tbody-tr-td">Brielle Williamson</td>
<td class="r-tbody-tr-td">Integration Specialist</td>
<td class="r-tbody-tr-td">New York</td>
<td class="r-tbody-tr-td">4804</td>
<td class="r-tbody-tr-td">2012/12/02</td>
<td class="r-tbody-tr-td">$372,000</td>
</tr>
<tr class="r-tbody-tr">
<td class="r-tbody-tr-td">Herrod Chandler</td>
<td class="r-tbody-tr-td">Sales Assistant</td>
<td class="r-tbody-tr-td">San Francisco</td>
<td class="r-tbody-tr-td">9608</td>
<td class="r-tbody-tr-td">2012/08/06</td>
<td class="r-tbody-tr-td">$137,500</td>
</tr>
<tr class="r-tbody-tr">
<td class="r-tbody-tr-td">Rhona Davidson</td>
<td class="r-tbody-tr-td">Integration Specialist</td>
<td class="r-tbody-tr-td">Tokyo</td>
<td class="r-tbody-tr-td">6200</td>
<td class="r-tbody-tr-td">2010/10/14</td>
<td class="r-tbody-tr-td">$327,900</td>
</tr>
<tr class="r-tbody-tr">
<td class="r-tbody-tr-td">Colleen Hurst</td>
<td class="r-tbody-tr-td">Javascript Developer</td>
<td class="r-tbody-tr-td">San Francisco</td>
<td class="r-tbody-tr-td">2360</td>
<td class="r-tbody-tr-td">2009/09/15</td>
<td class="r-tbody-tr-td">$205,500</td>
</tr>
<tr class="r-tbody-tr">
<td class="r-tbody-tr-td">Sonya Frost</td>
<td class="r-tbody-tr-td">Software Engineer</td>
<td class="r-tbody-tr-td">Edinburgh</td>
<td class="r-tbody-tr-td">1667</td>
<td class="r-tbody-tr-td">2008/12/13</td>
<td class="r-tbody-tr-td">$103,600</td>
</tr>
</tbody>
<tbody id="t-body-2" class="r-tbody no-display">
<tr class="r-tbody-tr">
<td class="r-tbody-tr-td">Jena Gaines</td>
<td class="r-tbody-tr-td">Office Manager Office Manager</td>
<td class="r-tbody-tr-td">London</td>
<td class="r-tbody-tr-td">3814</td>
<td class="r-tbody-tr-td">2008/12/19</td>
<td class="r-tbody-tr-td">$90,560</td>
</tr>
<tr class="r-tbody-tr">
<td class="r-tbody-tr-td">Quinn Flynn</td>
<td class="r-tbody-tr-td">Support Lead</td>
<td class="r-tbody-tr-td">Edinburgh</td>
<td class="r-tbody-tr-td">9497</td>
<td class="r-tbody-tr-td">2013/03/03</td>
<td class="r-tbody-tr-td">$342,000</td>
</tr>
<tr class="r-tbody-tr">
<td class="r-tbody-tr-td">Charde Marshall</td>
<td class="r-tbody-tr-td">Regional Director</td>
<td class="r-tbody-tr-td">San Francisco</td>
<td class="r-tbody-tr-td">6741</td>
<td class="r-tbody-tr-td">2008/10/16</td>
<td class="r-tbody-tr-td">$470,600</td>
</tr>
<tr class="r-tbody-tr">
<td class="r-tbody-tr-td">Haley Kennedy</td>
<td class="r-tbody-tr-td">Senior Marketing Designer</td>
<td class="r-tbody-tr-td">London</td>
<td class="r-tbody-tr-td">3597</td>
<td class="r-tbody-tr-td">2012/12/18</td>
<td class="r-tbody-tr-td">$313,500</td>
</tr>
<tr class="r-tbody-tr">
<td class="r-tbody-tr-td">Tatyana Fitzpatrick</td>
<td class="r-tbody-tr-td">Regional Director</td>
<td class="r-tbody-tr-td">London</td>
<td class="r-tbody-tr-td">1965</td>
<td class="r-tbody-tr-td">2010/03/17</td>
<td class="r-tbody-tr-td">$385,750</td>
</tr>
</tbody>
<tfoot class="r-tfoot">
<tr class="r-tfoot-tr">
<th class="r-tfoot-tr-th r-text-right" colspan="5" rowspan="1">Total</th>
<th class="r-tfoot-tr-th" colspan="1" rowspan="1">$2,120,754</th>
</tr>
</tfoot>
</table>
<div class="r-footer-controller">
</div>
</div>
Need to set th to some fixed width then columns will stop resizing. Since you have 6 columns I chose width: 16.6% for each th which is 100%/6.
let tbody1 = document.getElementById('t-body-1')
let tbody2 = document.getElementById('t-body-2')
setInterval(function () {
tbody1.classList.toggle('no-display');
tbody2.classList.toggle('no-display');
}, 1000)
table {
border-collapse: collapse;
-webkit-box-shadow: #e2e2e2 0 10px 20px;
-moz-box-shadow: #e2e2e2 0 10px 20px;
box-shadow: #e2e2e2 0 10px 20px;
border-radius: 10px;
overflow: hidden;
table-layout: fixed;
width: 934px;
}
.r-thead-tr-th, .r-tbody-tr-td, .r-tfoot-tr-th {
padding: 12px 25px;
text-align: left;
/*width: 1%;*/
overflow: hidden;
border-collapse: collapse;
}
.no-display {
display:none;
}
th {
width: 16.6%;
}
<div class="table-container" id="table-container">
<div class="r-header-controller"></div>
<table id="custom-table">
<thead class="r-thead">
<tr class="r-thead-tr">
<th class="r-thead-tr-th">Name</th>
<th class="r-thead-tr-th">Designation</th>
<th class="r-thead-tr-th">City</th>
<th class="r-thead-tr-th">Postal</th>
<th class="r-thead-tr-th">Start date</th>
<th class="r-thead-tr-th">Salary</th>
</tr>
</thead>
<tbody id="t-body-1" class="r-tbody">
<tr class="r-tbody-tr">
<td class="r-tbody-tr-td">Brielle Williamson</td>
<td class="r-tbody-tr-td">Integration Specialist</td>
<td class="r-tbody-tr-td">New York</td>
<td class="r-tbody-tr-td">4804</td>
<td class="r-tbody-tr-td">2012/12/02</td>
<td class="r-tbody-tr-td">$372,000</td>
</tr>
<tr class="r-tbody-tr">
<td class="r-tbody-tr-td">Herrod Chandler</td>
<td class="r-tbody-tr-td">Sales Assistant</td>
<td class="r-tbody-tr-td">San Francisco</td>
<td class="r-tbody-tr-td">9608</td>
<td class="r-tbody-tr-td">2012/08/06</td>
<td class="r-tbody-tr-td">$137,500</td>
</tr>
<tr class="r-tbody-tr">
<td class="r-tbody-tr-td">Rhona Davidson</td>
<td class="r-tbody-tr-td">Integration Specialist</td>
<td class="r-tbody-tr-td">Tokyo</td>
<td class="r-tbody-tr-td">6200</td>
<td class="r-tbody-tr-td">2010/10/14</td>
<td class="r-tbody-tr-td">$327,900</td>
</tr>
<tr class="r-tbody-tr">
<td class="r-tbody-tr-td">Colleen Hurst</td>
<td class="r-tbody-tr-td">Javascript Developer</td>
<td class="r-tbody-tr-td">San Francisco</td>
<td class="r-tbody-tr-td">2360</td>
<td class="r-tbody-tr-td">2009/09/15</td>
<td class="r-tbody-tr-td">$205,500</td>
</tr>
<tr class="r-tbody-tr">
<td class="r-tbody-tr-td">Sonya Frost</td>
<td class="r-tbody-tr-td">Software Engineer</td>
<td class="r-tbody-tr-td">Edinburgh</td>
<td class="r-tbody-tr-td">1667</td>
<td class="r-tbody-tr-td">2008/12/13</td>
<td class="r-tbody-tr-td">$103,600</td>
</tr>
</tbody>
<tbody id="t-body-2" class="r-tbody no-display">
<tr class="r-tbody-tr">
<td class="r-tbody-tr-td">Jena Gaines</td>
<td class="r-tbody-tr-td">Office Manager Office Manager</td>
<td class="r-tbody-tr-td">London</td>
<td class="r-tbody-tr-td">3814</td>
<td class="r-tbody-tr-td">2008/12/19</td>
<td class="r-tbody-tr-td">$90,560</td>
</tr>
<tr class="r-tbody-tr">
<td class="r-tbody-tr-td">Quinn Flynn</td>
<td class="r-tbody-tr-td">Support Lead</td>
<td class="r-tbody-tr-td">Edinburgh</td>
<td class="r-tbody-tr-td">9497</td>
<td class="r-tbody-tr-td">2013/03/03</td>
<td class="r-tbody-tr-td">$342,000</td>
</tr>
<tr class="r-tbody-tr">
<td class="r-tbody-tr-td">Charde Marshall</td>
<td class="r-tbody-tr-td">Regional Director</td>
<td class="r-tbody-tr-td">San Francisco</td>
<td class="r-tbody-tr-td">6741</td>
<td class="r-tbody-tr-td">2008/10/16</td>
<td class="r-tbody-tr-td">$470,600</td>
</tr>
<tr class="r-tbody-tr">
<td class="r-tbody-tr-td">Haley Kennedy</td>
<td class="r-tbody-tr-td">Senior Marketing Designer</td>
<td class="r-tbody-tr-td">London</td>
<td class="r-tbody-tr-td">3597</td>
<td class="r-tbody-tr-td">2012/12/18</td>
<td class="r-tbody-tr-td">$313,500</td>
</tr>
<tr class="r-tbody-tr">
<td class="r-tbody-tr-td">Tatyana Fitzpatrick</td>
<td class="r-tbody-tr-td">Regional Director</td>
<td class="r-tbody-tr-td">London</td>
<td class="r-tbody-tr-td">1965</td>
<td class="r-tbody-tr-td">2010/03/17</td>
<td class="r-tbody-tr-td">$385,750</td>
</tr>
</tbody>
<tfoot class="r-tfoot">
<tr class="r-tfoot-tr">
<th class="r-tfoot-tr-th r-text-right" colspan="5" rowspan="1">Total</th>
<th class="r-tfoot-tr-th" colspan="1" rowspan="1">$2,120,754</th>
</tr>
</tfoot>
</table>
<div class="r-footer-controller">
</div>
</div>
I would comment but my reputation isn't high enough for that yet.
Anyways,
I would think that your answer lies in the fact that the width in the following code needs to be changed to a static number, not a percent.
.r-thead-tr-th, .r-tbody-tr-td, .r-tfoot-tr-th {
padding: 12px 25px;
text-align: left;
/*width: 1%;*/
overflow: hidden;
border-collapse: collapse;
}
But also, you are targeting the classes .r-thead-tr-th, .r-tbody-tr-td, .r-tfoot-tr-th which are the cells themselves. It would probably be better if you targeted .r-thead.tr and .r-tbody-tr as these are the containers for your cells. I hope this fixes your issue.
try using html 'colspan' property

How do I set width of column with rowspan and colspan in table?

I have made an html page to display a status dash board for some of the systems at work. The systems in the first seven rows are kind of interconnected, so in addition to the status for each of them, I want to present the status for the combination of the seven systems. Technically this works great, but I am not entirely happy with the layout. I would like to have the yellow bar at the left to take up a smaller part of the first colum, not half of it.
The first three rows of the table are coded as:
<tr><th id="namehead"></th><th colspan="2" class="typehead">Data</th>
<th class="typehead">Strøm</th><th class="typehead">Komm.</th></tr>
<tr id="sys1"><td id="agg_data" class="data agg" rowspan="7" td><td id="sys1_data"
class="data sys1"></td><td id="sys1_power" class="power sys1"></td><td id="sys1_comm"
class="comm sys1"></td></tr>
<tr id="sys2"><td id="sys2_data" class="data"></td><td id="sys2_power" class="power"></td>
<td id="sys2_comm" class="comm"></td></tr>
Then from the 8th status row, I do:
<tr id="arc"><td id="arc_data" class="data" colspan="2"></td>
<td id="arc_power" class="power"></td><td id="arc_comm" class="comm"></td></tr>
in my css, the class "typehead" has set {width: 100px;}. I have tried to set width on the cells of the first status row, although it does not give me any kind of errors, it does not work either (firefox and chrome) Is it somehow possible to achieve this in css?
Most likely the content is stretching the table cell. You can avoid this if you wrap the content in a div and size it as needed. And, as an option, arrange the text vertically.
.typehead {
width: 100px;
font: bold 20px/1 sans-serif;
color: #e3e3e3;
background-color: #262626;
}
td {
padding: 4px;
text-align: right;
background-color: #31a72c;
}
tr:nth-child(2) td:nth-child(1) {
width: 1em;
background-color: #ffee52;
}
.vertical {
writing-mode: vertical-rl;
transform: rotate(.5turn);
}
<table>
<tr>
<!--th id="namehead"></th-->
<th colspan="2" class="typehead">Data</th>
<th class="typehead">Strøm</th>
<th class="typehead">Komm.</th>
</tr>
<tr id="sys1">
<td id="agg_data" class="data agg" rowspan="7">
<div class='vertical'>agg_data</div>
</td>
<td id="sys1_data" class="data sys1">sys1_data</td>
<td id="sys1_power" class="power sys1">sys1_power</td>
<td id="sys1_comm" class="comm sys1">sys1_comm</td>
</tr>
<tr id="sys2">
<td id="sys2_data" class="data">sys2_data</td>
<td id="sys2_power" class="power">sys2_power</td>
<td id="sys2_comm" class="comm">sys2_comm</td>
</tr>
<tr id="sys3">
<td id="sys3_data" class="data">sys3_data</td>
<td id="sys3_power" class="power">sys3_power</td>
<td id="sys3_comm" class="comm">sys3_comm</td>
</tr>
<tr id="sys4">
<td id="sys4_data" class="data">sys4_data</td>
<td id="sys4_power" class="power">sys4_power</td>
<td id="sys4_comm" class="comm">sys4_comm</td>
</tr>
<tr id="sys5">
<td id="sys5_data" class="data">sys5_data</td>
<td id="sys5_power" class="power">sys5_power</td>
<td id="sys5_comm" class="comm">sys5_comm</td>
</tr>
<tr id="sys6">
<td id="sys6_data" class="data">sys6_data</td>
<td id="sys6_power" class="power">sys6_power</td>
<td id="sys6_comm" class="comm">sys6_comm</td>
</tr>
<tr id="sys7">
<td id="sys7_data" class="data">sys7_data</td>
<td id="sys7_power" class="power">sys7_power</td>
<td id="sys7_comm" class="comm">sys7_comm</td>
</tr>
<tr id="arc">
<td id="arc_data" class="data" colspan="2">arc_data</td>
<td id="arc_power" class="power">arc_power</td>
<td id="arc_comm" class="comm">arc_comm</td>
</tr>
<tr id="arc">
<td id="arc_data" class="data" colspan="2">arc_data</td>
<td id="arc_power" class="power">arc_power</td>
<td id="arc_comm" class="comm">arc_comm</td>
</tr>
<tr id="arc">
<td id="arc_data" class="data" colspan="2">arc_data</td>
<td id="arc_power" class="power">arc_power</td>
<td id="arc_comm" class="comm">arc_comm</td>
</tr>
<tr id="arc">
<td id="arc_data" class="data" colspan="2">arc_data</td>
<td id="arc_power" class="power">arc_power</td>
<td id="arc_comm" class="comm">arc_comm</td>
</tr>
<tr id="arc">
<td id="arc_data" class="data" colspan="2">arc_data</td>
<td id="arc_power" class="power">arc_power</td>
<td id="arc_comm" class="comm">arc_comm</td>
</tr>
</table>

HTML Table Query not Sequence

I trying to query my html table but somehow it did not show correctly.
First row is correct.
Second row start from No.1,16/Sept/2020,36.5,Q1- Y,Q2- Y,Q3- YQ4- Y did not follow up the First row.
Please see my jsFiddle for better understanding.
<style>
table, th, td {
border: 1px solid black;
}
</style>
<table>
<tr>
<td rowspan=4>S/No.</td>
<td rowspan=6>Date</td>
<td rowspan=3>Temperature</td>
<td colspan=4>Please answer the above 4 questions</td>
<td rowspan=8>Submit</td>
</tr>
<tr>
<td >Q1</td>
<td >Q2</td>
<td >Q3</td>
<td >Q4</td>
</tr>
<tr>
<td colspan=4>Y - Yes , N- No</td>
</tr>
<tr>
<td>No 1</td>
<td>16/Sept/2020</td>
<td>36.5</td>
<td>Q1- Y</td>
<td>Q2- Y</td>
<td>Q3- Y</td>
<td>Q4- Y</td>
</tr>
</table>
Hope this is what you are looking for.
table, th, td {
border: 1px solid black;
}
<table>
<tr>
<td rowspan=3>S/No.</td>
<td rowspan=3>Date</td>
<td rowspan=3>Temperature</td>
<td colspan=4>Please answer the above 4 questions</td>
<td rowspan=4>Submit</td>
</tr>
<tr>
<td >Q1</td>
<td >Q2</td>
<td >Q3</td>
<td >Q4</td>
</tr>
<tr>
<td colspan=4>Y - Yes , N- No</td>
</tr>
<tr>
<td>No 1</td>
<td>16/Sept/2020</td>
<td>36.5</td>
<td>Q1- Y</td>
<td>Q2- Y</td>
<td>Q3- Y</td>
<td>Q4- Y</td>
</tr>
</table>

Pattern table in HTML

I want to create a table as given. I have written the code for the first two columns but the output is incorrect. Need help figuring out my mistakes.
Ignore the little imperfections of the image of the table given in the question. They are not part of the output I desire.
Question-
My attempt for first two columns-
<table border="1" width="50%" height="50%">
<tr>
<td rowspan="6"></td>
<td rowspan="3"></td>
<td rowspan="1"></td>
</tr>
<tr>
<td rowspan="0" colspan="0"></td>
<td rowspan="3"></td>
<td rowspan="1"></td>
</tr>
</table>
Output-
What am I missing here?
I believe that this is what you're after:
table, td {
border: 1px solid #999;
}
table {
width: 100%;
}
td {
height: 50px;
}
<table>
<tr>
<td rowspan="4"></td>
<td rowspan="2"></td>
<td></td>
</tr>
<tr>
<td rowspan="2"></td>
</tr>
<tr>
<td rowspan="2"></td>
</tr>
<tr>
<td></td>
</tr>
</table>

Space on html table

This is an easy question, but I cannot seem to solve it. My html table can be seen at the following:
http://jsfiddle.net/Rochefort/kvUKG/
And also included here:
<table style="background:#fff;width:300px;margin-left:14px;" class="form">
<tbody>
<tr style="">
<td class="bosluk"></td>
<td class="alis_baslik"><strong>ALIŞ</strong></td>
<td class="satis_baslik"><strong>SATIŞ</strong></td>
</tr>
<tr style="border-bottom:1px solid #e4e4e4;">
<td class="ikonlar"><strong>$ </strong></td>
<td class="kurlar">DOLAR</td>
<td class="alis">2.2804</td>
<td class="satis">2.2914</td>
</tr>
<tr style="border-bottom:1px solid #e4e4e4;">
<td class="ikonlar"><strong>$ </strong></td>
<td class="kurlar"><strong>DOLAR</strong></td>
<td class="alis">2.2804</td>
<td class="satis">2.2914</td>
</tr>
<tr style="border-bottom:1px solid #e4e4e4;">
<td class="ikonlar"><strong>$ </strong></td>
<td class="kurlar"><strong>DOLAR</strong></td>
<td class="alis">2.2804</td>
<td class="satis">2.2914</td>
</tr>
<tr style="border-bottom:1px solid #e4e4e4;">
<td class="ikonlar"><strong>$ </strong></td>
<td class="kurlar"><strong>DOLAR</strong></td>
<td class="alis">2.2804</td>
<td class="satis">2.2914</td>
</tr>
</tbody>
</table>
I implemented CSS but the DOLLAR item has too much space. How can I remove this extra space?
You can use text-align: right with padding-right instead of padding-left.
Example: http://jsfiddle.net/BfD2v/
.ikonlar {
padding-right:5px;
font-family: Arial;
font-size:12px;
font-weigth: bold;
color: #000;
text-align: right;
}
If you want to make the whole column narrower, you can set the width od the column with this:
.bosluk, .ikonlar {
width: 10px;
}
You should also probably use <th> tags for the headers. The columns would align themselves under the <td> tags then. Like:
<table border="1">
<tr>
<th>Month</th>
<th>Savings</th>
</tr>
<tr>
<td>January</td>
<td>$100</td>
</tr>
<tr>
<td>February</td>
<td>$80</td>
</tr>
</table>