Adjust spacing between HTML table rows - html

I want to display records one by one in sequence, I do not know why the extra space appears between the records. Can anyone help me please?
{block name=head}
<style>
td {
border: none;
font-weight: bold;
font-size: 100%;
}
.h1 {
margin: 3px, 0px;
}
.content {
height: 270px;
border: 1px solid black;
font-size: 100%;
width: 80%;
margin: 0 auto;
border-top: none;
font-family: Times New Roman;
}
.footer {
height: 30px;
border: 1px solid black;
width: 80%;
margin: 0 auto;
font-family: Terminal;
}
.details-table {
border-collapse: collapse;
}
.details-table td {
border-bottom: 1px solid #666;
padding: 5px;
border-right: 1px solid #666;
}
.details-table td.no-right-border {
border-right: none;
}
.details-table td.no-bottom-border {
border-bottom: none;
}
</style>
{/block}
{block name=body}
<div class="footer">
<table align="center" width="80%">
<tr>
<td style="text-align:left;">Name : {$partyName}</td>
<td style="text-align:center;">Date : {$salesDate}</td>
<td style="text-align:right;">Fine : {$totFine|string_format:"%.3f"}</td>
</tr>
</table>
</div>
<div class="content">
<table align="center" width="100%" class="details-table">
<tr height="30">
<td>Item</td>
<td style="text-align:center;">Gross</td>
<td style="text-align:center;">Less</td>
<td style="text-align:center;">Net</td>
<td style="text-align:center;">Touch</td>
<td style="text-align:center;">Wastage</td>
<td style="text-align:center;">Fine</td>
</tr>
{section name="sec" loop=$dtArray}
<tr>
<td valign="top" class="no-bottom-border">{$dtArray[sec].itemId}</td>
<td valign="top" style="text-align:center;" class="no-bottom-border">{$hsnCode}</td>
<td valign="top" style="text-align:center;" class="no-bottom-border">{$fine}</td>
<td valign="top" style="text-align:center;" class="no-bottom-border">{$rate}</td>
<td valign="top" style="text-align:center;" class="no-bottom-border">{$amount|string_format:"%.2f"}</td>
<td valign="top" style="text-align:center;" class="no-bottom-border">{$amount|string_format:"%.2f"}</td>
<td valign="top" style="text-align:center;" class="no-bottom-border">{$amount|string_format:"%.2f"}</td>
</tr>
{/section}
</table>
</div>
{/block}

You have height:270px set on the <div class="content">, and height="100%" set on the <table>, and the table is an immediate child of that div, so it inherits the height. That's why you're seeing the extra space when there are only a couple of rows. Simply reset or remove either of the height value to fix that.
EDIT
In the other case, if you want to keep the height set on the table, and only have the empty space to display at the bottom, you can add an empty row and set it to height:100%.
.details-table {
height: 270px;
width: 80%;
margin: 0 auto;
border-collapse: collapse;
}
.details-table td {
border: 1px solid #666;
padding: 5px;
}
<table class="details-table">
<tr>
<td>Item</td>
<td>Gross</td>
<td>Less</td>
<td>Net</td>
<td>Touch</td>
<td>Wastage</td>
<td>Fine</td>
</tr>
<tr>
<td>...</td>
<td>...</td>
<td>...</td>
<td>...</td>
<td>...</td>
<td>...</td>
<td>...</td>
</tr>
<!-- insert empty row -->
<tr style="height:100%;">
<td></td>
<td></td>
<td></td>
<td></td>
<td></td>
<td></td>
<td></td>
</tr>
</table>

Related

Styling DIVs inside Tables

I am trying to define a weekly calendar, have a table with seven columns (one per day) and 24 rows (one per half an hour):
.cal-week {
border-collapse: collapse;
}
.cal-week-day {
width: 14%;
}
.cal-week-hour > td {
border: solid 1px #d8d8d8;
height: 2.2em;
position: relative;
}
.cal-week-hour > td > div {
position: absolute;
top: 0px;
z-index: 5;
width: 100%;
}
.item {
background-color: #494C4F;
color: #f4f4f4;
border: solid 1px #c8c8c8;
}
.item > div {
white-space: nowrap;
}
<table class="cal-week" cellpadding="0" cellspacing="0">
<tbody>
<tr>
<th class="cal-week-day">
monday
</th>
<th class="cal-week-day">
tuesday
</th>
<th class="cal-week-day">
wednesday
</th>
</tr>
<tr class="cal-week-hour">
<td>
<div/>
</td>
<td>
<div/>
</td>
<td>
<div/>
</td>
</tr>
<tr class="cal-week-hour">
<td>
<div/>
</td>
<td>
<div>
<table cellpadding="0" cellspacing="0" width="100%">
<tbody>
<tr>
<td class="item" width="33.333333333333336%" >
<div>a long description</div>
</td>
<td class="item" width="33.333333333333336%" >
<div>normal desc</div>
</td>
<td class="item" width="33.333333333333336%" >
<div>short</div>
</td>
</tr>
</tbody>
</table>
</div>
</td>
<td>
<div/>
</td>
</tr>
<tr class="cal-week-hour">
<td>
<div/>
</td>
<td>
<div/>
</td>
<td>
<div/>
</td>
</tr>
<tr class="cal-week-hour">
<td>
<div/>
</td>
<td>
<div/>
</td>
<td>
<div/>
</td>
</tr>
<tr class="cal-week-hour">
<td>
<div/>
</td>
<td>
<div>
<table cellpadding="0" cellspacing="0" width="100%">
<tbody>
<tr>
<td class="item">
<div>asdsad</div>
</td>
</tr>
</tbody>
</table>
</div>
</td>
<td>
<div/>
</td>
</tr>
</tbody>
</table>
I am using React, the percentage of the tds of the inner tables are calculated as 100 / numberOfItems, in this example since we have 3 items -> 33.333333%. The problem is that the divs can be wider than the tds and as you can see in the fiddler they span over the next column.
The desired output is the following:
In fact, I have to draw n boxes which have to fit the parent (td) width, which in this case is dynamic. Furthermore, it should be responsive, so I cannot use static widths.
Any hints how to achieve such a result?
You can make the .item class into an inline-block element which will fix the 33% width.
Also because the border is added after the 33% width, your item is a bit to wide (it will be 33% + 1px left-border + 1px-right border).
you should consider giving the .item class a box-sizing: border-box; so the border will be inside this 33% width.
After this you get your desired output. See fiddle: https://jsfiddle.net/d2burtaz/
I also changed your min-height from those td's from 141px to 41px so it looks more like the picture you added.
-- Can you give me an example using just divs? question by Emaborsa.
Ofcourse, I would just remove the inner table with all its table elements, also remove the empty div's. And change the <td>'s into <div>'s. The only thing I have added after this is a .w-100 class which I added to the outer div so the 33% width on the inner children works.
.cal-week {
border-collapse: collapse;
font-size: 14px;
font-family: "Segoe UI", "Segoe UI Web (West European)", "Segoe UI", -apple-system, BlinkMacSystemFont, Roboto, "Helvetica Neue", sans-serif;
}
.cal-week-top {
font-weight: normal;
text-align: left;
color: #444;
padding: 2px;
text-transform: uppercase;
}
.cal-week-day {
width: 14%;
}
.cal-week-day-link:hover {
cursor: pointer;
text-decoration: underline;
}
.cal-week-weeksel div {
width: 16px;
}
.cal-week-weeksel:hover {
cursor: pointer;
background-color: var(--hover-light);
}
.cal-week-time00 {
text-align: right;
border-right: solid 1px #d8d8d8);
border-left: solid 1px #d8d8d8;
padding: 1px 5px 2px 5px;
}
.cal-week-hour00 > td,
.cal-week-time {
border-top: solid 1px #d8d8d8;
border-bottom: dashed 1px #d8d8d8;
}
.cal-week-hour30 > td{
border-bottom: solid 1px #d8d8d8;
}
.cal-week-time30,
.cal-week-cell {
border-right: solid 1px #d8d8d8;
border-left: solid 1px #d8d8d8;
height: 2.2em;
}
.cal-week-cell {
position: relative;
}
.cal-week-cell > div {
position: absolute;
top: 0px;
z-index: 5;
width: 100%;
}
.cal-week-today {
background-color: var(--button-border-disabled);
}
.item {
background-color: #494C4F;
color: #f4f4f4;
padding: 1px 2px 2px 2px;
border: solid 1px #c8c8c8;
display: inline-block;
box-sizing: border-box;
}
.item a {
color: #f4f4f4;
}
.item a:hover {
text-decoration: underline;
}
.w-100{
width: 100%;
}
<table class="cal-week" cellpadding="0" cellspacing="0">
<tbody>
<tr>
<th class="cal-week-top cal-week-day">
<div class="cal-week-day-link">26. Dienstag</div>
</th>
<th class="cal-week-top cal-week-day">
<div class="cal-week-day-link">27. Mittwoch</div>
</th>
<th class="cal-week-top cal-week-day">
<div class="cal-week-day-link">28. Donnerstag</div>
</th>
</tr>
<tr class="cal-week-hour00">
<td class="cal-week-cell">
<div/>
</td>
<td class="cal-week-cell">
<div/>
</td>
<td class="cal-week-cell">
<div/>
</td>
</tr>
<tr class="cal-week-hour30">
<td class="cal-week-cell">
<div/>
</td>
<td class="cal-week-cell">
<div class="w-100">
<div class="item single" title="10:30 - 14:25 Titel (Beschreibung)" style="min-height: 41px; width: 33.333336%;">
Titel
<div>Beschreibung</div>
</div><div class="item single" title="10:30 - 14:25 Titel (Beschreibung)" style="min-height: 41px; width: 33.333336%;">
Titel
<div>Beschreibung</div>
</div><div class="item single" title="10:30 - 14:25 Titel (Beschreibung)" style="min-height: 41px; width: 33.333336%;">
Titel
<div>Beschreibung</div>
</div>
</div>
</td>
<td class="cal-week-cell">
<div/>
</td>
</tr>
<tr class="cal-week-hour00">
<td class="cal-week-cell">
<div/>
</td>
<td class="cal-week-cell">
<div/>
</td>
<td class="cal-week-cell">
<div/>
</td>
</tr>
<tr class="cal-week-hour30">
<td class="cal-week-time30"/>
<td class="cal-week-cell">
<div/>
</td>
<td class="cal-week-cell">
<div/>
</td>
</tr>
<tr class="cal-week-hour00">
<td class="cal-week-cell">
<div/>
</td>
<td class="cal-week-cell">
<div>
<table cellpadding="0" cellspacing="0" width="100%">
<tbody>
<tr>
<td class="item single" title="12:26 - 13:26 sdsdsd (asdsad)" width="100%" style="min-height: 61px;">
<div>
<div>
sdsdsd
</div>
<div>asdsad</div>
</div>
</td>
</tr>
</tbody>
</table>
</div>
</td>
<td class="cal-week-cell">
<div/>
</td>
</tr>
</tbody>
</table>

How to make a table cell merge two rows and two columns?

Here is what I need to do:
Red: two columns and two rows
Purple: two columns
Blue: two rows
yellow and white: normal cell
Here is my table so far:
Here is my html code:
<body>
<div id="container">
<table id="board">
<tr>
<td colspan="2"></td>
<td></td>
<td colspan="2"></td>
</tr>
<tr>
<td colspan="2" rowspan="2"></td>
<td rowspan="2"></td>
<td></td>
<td></td>
</tr>
<tr>
<td></td>
<td></td>
</tr>
<tr>
<td colspan="2"></td>
<td ></td>
<td colspan="2"></td>
</tr>
</table>
</div>
</body>
Here is my css:
*{
padding: 0;
margin: 0;
box-sizing: border-box;
}
body {
display: flex;
background-color: #114B5F;
text-align: center;
flex-direction: column;
padding-top: 2%;
}
#container {
width: 800px;
height: 500px;
background: #E4FDE1;
margin: 10px auto;
}
#board
{
width: 100%;
height: 100%;
border: 1px solid black;
}
td
{
border: 1px solid black;
}
Somehow the cell that is supposed to occupy two rows and two cells (Red in 1st image) it appears that is only occupying two rows even though the code says otherwise. Is it something on css? How can I fix this?
Your HTML did it already. To see this, do what follows. Comment the first
<td colspan="2"></td>
in the last row of your cell and substitute it with
<td></td>
<td></td>
At least as long as you have no content within any cell, the default width of the first two columns (merged by the consistent colspan="2" attributes) and the third column alone is the same so you do not notice the difference. I add a snippet just to show:
*{
padding: 0;
margin: 0;
box-sizing: border-box;
}
body {
display: flex;
background-color: #114B5F;
text-align: center;
flex-direction: column;
padding-top: 2%;
}
#container {
width: 800px;
height: 500px;
background: #E4FDE1;
margin: 10px auto;
}
#board {
width: 100%;
height: 100%;
border: 1px solid black;
}
td {
border: 1px solid black;
}
td.cblu{background-color:#0040ff}
td.clbl{background-color:#0080ff}
td.cred{background-color:#ff1a1a}
td.cwhi{background-color:#f8f8f8}
td.cyel{background-color:#ffff33}
<body>
<div id="container">
<table id="board">
<tr>
<td class="cblu" colspan="2"></td>
<td class="cwhi"></td>
<td class="cblu" colspan="2"></td>
</tr>
<tr>
<td class="cred" colspan="2" rowspan="2"></td>
<td class="clbl" rowspan="2"></td>
<td class="cyel"></td>
<td class="cyel"></td>
</tr>
<tr>
<td class="cyel"></td>
<td class="cyel"></td>
</tr>
<tr>
<td class="cblu"></td>
<td class="cblu"></td>
<!--<td class="cblu" colspan="2"></td>-->
<td class="cwhi"></td>
<td class="cblu" colspan="2"></td>
</tr>
</table>
</div>
</body>
Here I added the colors using some classes. I'd like to remark that no more edits to your DOM (html) is necessary to achieve what you want. But controlling responsively the width of the cells or columns of your table may not be trivial.

How to place image over this table and make the position responsive

I have placed the image but it breaks when we resize the window.
I want it in the center of the first column which is description below the email service.
I want it to remain in the center all the time.
I have given the td position relative and made the image absolute position. Its relative to the td................................
* {
font-family: sans-serif;
}
table{
width: 100%;
border: 1px solid #edf2fc;
border-collapse: collapse;
margin-top: 30px;
}
table th {
padding: 11px 6px 11px 6px;
word-break: break-all;
background: #413fa4;
color: #fff;
text-align: center;
}
tr td {
border: 1px solid #cbdaf1;
}
table tbody td {
text-align: center;
padding: 33px 0 33px 0;
word-break: break-all;
font-size: 18px;
}
tfoot tr td {
padding-top: 4px;
padding-bottom: 4px;
}
tfoot tr td:first-child{
padding-right: 22px;
}
.gray {
background-color: lightgray
}
<table width="100%">
<thead style="background-color: lightgray;">
<tr>
<th>Description</th>
<th>Cost</th>
</tr>
</thead>
<tbody>
<tr>
<td style="position: relative">Email Service
<img style="position: absolute; left: 300px; top: 70px;" src="https://image.shutterstock.com/image-vector/paid-thank-you-grunge-rubber-260nw-564254104.jpg"width=130px;>
</td>
<td align="center">1400.00</td>
</tr>
</tbody>
<tfoot>
<tr>
<td align="right">Subtotal</td>
<td align="center">1635.00</td>
</tr>
<tr>
<td align="right">Tax</td>
<td align="center">294.3</td>
</tr>
<tr>
<td align="right">Discount</td>
<td align="center">294.3</td>
</tr>
<tr>
<td align="right">Total</td>
<td align="center" class="gray">$ 1929.3</td>
</tr>
</tfoot>
</table>
Wrap the text and the image inside a div with a flex box property, and then you can center it as you like
* {
font-family: sans-serif;
}
table{
width: 100%;
border: 1px solid #edf2fc;
border-collapse: collapse;
margin-top: 30px;
}
table th {
padding: 11px 6px 11px 6px;
word-break: break-all;
background: #413fa4;
color: #fff;
text-align: center;
}
tr td {
border: 1px solid #cbdaf1;
}
table tbody td {
text-align: center;
padding: 33px 0 33px 0;
word-break: break-all;
font-size: 18px;
}
tfoot tr td {
padding-top: 4px;
padding-bottom: 4px;
}
tfoot tr td:first-child{
padding-right: 22px;
}
.gray {
background-color: lightgray
}
.flex-b {
display:flex;
align-items:center;
justify-content:center;
}
<table width="100%">
<thead style="background-color: lightgray;">
<tr>
<th>Description</th>
<th>Cost</th>
</tr>
</thead>
<tbody>
<tr>
<td>
<div class="flex-b">
<span>Email Service</span>
<img src="https://image.shutterstock.com/image-vector/paid-thank-you-grunge-rubber-260nw-564254104.jpg"width=130px;>
</div>
</td>
<td align="center">1400.00</td>
</tr>
</tbody>
<tfoot>
<tr>
<td align="right">Subtotal</td>
<td align="center">1635.00</td>
</tr>
<tr>
<td align="right">Tax</td>
<td align="center">294.3</td>
</tr>
<tr>
<td align="right">Discount</td>
<td align="center">294.3</td>
</tr>
<tr>
<td align="right">Total</td>
<td align="center" class="gray">$ 1929.3</td>
</tr>
</tfoot>
</table>

Prevent <td> from expanding when inserting content

I have a table of fixed width and height containing three rows and columns. Rows and columns are automatically equal size, but when I put innerHTML (or image) into table cell, cell with text inside expands at the cost of other columns. How to prevent table cells from expanding after inserting content inside? I've tried solutions from similar stack overflow questions, but nothing worked.
JS fiddle: https://jsfiddle.net/m20akmdx/14/
document.getElementById('8').innerHTML = 'R';
table {
width: 360px;
height: 360px;
border: 1px solid black;
border-collapse: collapse;
}
td {
border: 1px solid black;
text-align: center;
}
<table id="table">
<tr>
<td id="1"></td>
<td id="2"></td>
<td id="3"></td>
</tr>
<tr>
<td id="4"></td>
<td id="5"></td>
<td id="6"></td>
</tr>
<tr>
<td id="7"></td>
<td id="8"></td>
<td id="9"></td>
</tr>
</table>
Try using fixed table layout.
table {
table-layout: fixed;
...
}
And adding a no-break space into each cell.
td:after {
content: "\00A0";
}
document.getElementById('8').innerHTML = 'R';
table {
table-layout: fixed;
width: 360px;
height: 360px;
border: 1px solid black;
border-collapse: collapse;
}
td {
border: 1px solid black;
text-align: center;
}
td:after {
content: "\00A0";
}
<table id="table">
<tr>
<td id="1"></td>
<td id="2"></td>
<td id="3"></td>
</tr>
<tr>
<td id="4"></td>
<td id="5"></td>
<td id="6"></td>
</tr>
<tr>
<td id="7"></td>
<td id="8"></td>
<td id="9"></td>
</tr>
</table>
Set the width and height of the td elements rather than a width and height for the table and you will get the desired behaviour.
document.getElementById('8').innerHTML = 'Raaaa';
table{
border: 1px solid black;
border-collapse: collapse;
}
td{
width:120px;
height:120px;
border: 1px solid black;
text-align: center;
}
<table id="table">
<tr>
<td id="1"></td>
<td id="2"></td>
<td id="3"></td>
</tr>
<tr>
<td id="4"></td>
<td id="5"></td>
<td id="6"></td>
</tr>
<tr>
<td id="7"></td>
<td id="8"></td>
<td id="9"></td>
</tr>
</table>
set a max-width
td{
border: 1px solid black;
text-align: center;
max-width: 200px;
}
or
td{
border: 1px solid black;
text-align: center;
max-width: 30%;
}
You will need to specify the td width, and maybe the height as well:
https://jsfiddle.net/m20akmdx/23/
document.getElementById('8').innerHTML = 'my long text gets wrapped';
table {
width: 360px;
height: 360px;
border: 1px solid black;
border-collapse: collapse;
}
td {
width: calc(100% / 3);
height: calc(100% / 3);
border: 1px solid black;
text-align: center;
}
<table id="table">
<tr>
<td id="1"></td>
<td id="2"></td>
<td id="3"></td>
</tr>
<tr>
<td id="4"></td>
<td id="5"></td>
<td id="6"></td>
</tr>
<tr>
<td id="7"></td>
<td id="8"></td>
<td id="9"></td>
</tr>
</table>

override a html table td style

I am trying to overwrite a td style like this:
.valuator .sw-slots table, tr, td { width 100% }
so I did this:
td.license-name-td{
width: 100px !important;
}
The table took always the "global" style and overwrites, rather ignores my style. Even chrome doesn't cross the link out, it just ignores that part.
td.license-name-td {
width: 100px !important
}
.valuator .sw-slots table, tr, td {
width: 100%;
}
(Chrome computed css output)
Is there a special way to overwrite the td tag afterwards?
.valuator .sw-slots table, tr, td {
width: 100%;
margin: 0;
padding: 0;
border: 0;
font-size: 100%;
font: inherit;
vertical-align: baseline;
border-collapse: collapse;
border-spacing: 0;
text-align: right;
color: #3c3c3c;
}
table.license-table td.license-name-td {
text-align: left !important;
word-break: break-word;
overflow: hidden;
width: 100px !important;
}
table.license-table td.license-td {
text-align: left !important;
margin-left: 3px;
word-break: break-word;
}
<table class="t3lsg license-table" style="font-size: 12px;">
<tbody><tr>
<th style="text-align: left;">Software</th>
<th style="text-align: left;">Version</th>
<th style="text-align: left;">Source</th>
<th style="text-align: left;">License</th>
</tr>
<tr>
<td colspan="4">
<div style="height: 1px; background-color: lightgrey; margin: 3px 0 3px 0;">
</div>
</td>
</tr>
<tr>
<td class="license-name-td">Fleck</td>
<td class="license-td">0.9.6.19</td>
<td class="license-td">https://github.com/statianzo/Fleck</td>
<td class="license-td">MIT License</td>
</tr>
<tr>
<td colspan="4">
<div style="height: 1px; background-color: lightgrey; margin: 3px 0 3px 0;">
</div>
</td>
</tr>
<tr>
<td class="license-name-td">HTML Agility Pack</td>
<td class="license-td">HAP 1.4.6</td>
<td class="license-td">http://code.google.com/p/heartcode-canvasloader/</td>
<td class="license-td">Microsoft Public License </td>
</tr>
<tr>
<td colspan="4">
<div style="height: 1px; background-color: lightgrey; margin: 3px 0 3px 0;">
</div>
</td>
</tr>
<tr>
<td class="license-name-td">jQuery</td>
<td class="license-td">1.10.2002</td>
<td class="license-td">http://jquery.com</td>
<td class="license-td">MIT License</td>
</tr>
<tr>
<td colspan="4">
<div style="height: 1px; background-color: lightgrey; margin: 3px 0 3px 0;">
</div>
</td>
</tr>
<tr>
<td class="license-name-td">jQuery Knob</td>
<td class="license-td">11.2.8</td>
<td class="license-td">http://anthonyterrien.com/knob</td>
<td class="license-td">MIT License</td>
</tr>
</table>
EDIT: I changed one mistake, that i forgot to change one inline style to a class, now this is the new result.
First, in your example code, I added the two enclosing div's (.valuator, .sw-slots) so that the first CSS rule applies to the table.
After that, you need to make sure that the widths of the table cell are set to a default of auto except for td.license-name-td which had a 100px width.
You need to reset the td for the separator td[colspan="4"] to width: auto and then the same for td.license-td.
I think this is what you need. Just be on the look out for other CSS rules that might be in hour style sheets that might override these.
.valuator .sw-slots table, tr, td {
width: 100%;
margin: 0;
padding: 0;
border: 0;
font-size: 100%;
font: inherit;
vertical-align: baseline;
border-collapse: collapse;
border-spacing: 0;
text-align: right;
color: #3c3c3c;
}
td[colspan="4"] {
width: auto;
}
td.license-name-td {
text-align: left;
word-break: break-word;
overflow: hidden;
width: 100px;
background-color: lightblue;
}
td.license-td {
text-align: left;
margin-left: 3px;
word-break: break-word;
width: auto;
}
<div class="valuator">
<div class="sw-slots">
<table class="t3lsg" style="font-size: 12px;">
<tbody>
<tr>
<th style="text-align: left;">Software</th>
<th style="text-align: left;">Version</th>
<th style="text-align: left;">Source</th>
<th style="text-align: left;">License</th>
</tr>
<tr>
<td colspan="4">
<div style="height: 1px; background-color: lightgrey; margin: 3px 0 3px 0;">
</div>
</td>
</tr>
<tr>
<td class="license-name-td">Fleck</td>
<td class="license-td">0.9.6.19</td>
<td class="license-td">https://github.com/statianzo/Fleck</td>
<td class="license-td">MIT License</td>
</tr>
<tr>
<td colspan="4">
<div style="height: 1px; background-color: lightgrey; margin: 3px 0 3px 0;">
</div>
</td>
</tr>
<tr>
<td class="license-name-td">HTML Agility Pack</td>
<td class="license-td">HAP 1.4.6</td>
<td class="license-td">http://code.google.com/p/heartcode-canvasloader/</td>
<td class="license-td">Microsoft Public License</td>
</tr>
<tr>
<td colspan="4">
<div style="height: 1px; background-color: lightgrey; margin: 3px 0 3px 0;">
</div>
</td>
</tr>
<tr>
<td class="license-name-td">jQuery</td>
<td class="license-td">1.10.2002</td>
<td class="license-td">http://jquery.com</td>
<td class="license-td">MIT License</td>
</tr>
<tr>
<td colspan="4">
<div style="height: 1px; background-color: lightgrey; margin: 3px 0 3px 0;">
</div>
</td>
</tr>
<tr>
<td class="license-name-td">jQuery Knob</td>
<td class="license-td">11.2.8</td>
<td class="license-td">http://anthonyterrien.com/knob</td>
<td class="license-td">MIT License</td>
</tr>
</table>
</div>
</div>
i've added a class name to my table and changed the class names to:
table.license-table td.license-td{
text-align: left !important;
margin-left:3px;
word-break: break-word;
width: 100px !important;
}
table.license-table td.license-name-td{
text-align: left !important;
word-break: break-word;
overflow: hidden;
width: 100px !important;
}
this solves my problem.
The problem is that the width: 100% also applies to the table. And because a all cells in a row must count up to the width of the table, it will not work to just restrict the width of the cell, you also must address the table, or the other cells in the row.
I do not know what your HTML looks like, but if the cell is the only one in the row, you could add a class to the table instead of the cell and set the width of the table to 100px in the same way as you did for the cell, you do not have to restrict the width of the cell than, as that will be automatically.