z-index is not working inside table - html

Why z-index is not working inside table?
I have a table with 4 column that one column is positioned outside of table, so that it seem as tabs, but I cannot hidden right side of tabs under table.
Please see this code snippet:
div {
position: relative;
z-index: 5;
width: 70%;
margin: auto;
height: 500px;
background-color: red;
}
table {
border: none;
border-spacing: 0 11px;
width: 100%;
table-layout: fixed;
}
td.tab {
background-color: white;
padding: 15px;
width: 20%;
position: absolute;
z-index: -15;
right: 90%;
}
td.plan {
padding: 15px;
width: 33.3%;
text-align: center;
}
<div class="bottom">
<table>
<tbody>
<tr>
<td class="tab">test</td>
<td class="plan">test</td>
<td class="plan">test</td>
<td class="plan">test</td>
</tr>
<tr>
<td class="tab">test</td>
<td class="plan">test</td>
<td class="plan">test</td>
<td class="plan">test</td>
</tr>
<tr>
<td class="tab">test</td>
<td class="plan">test</td>
<td class="plan">test</td>
<td class="plan">test</td>
</tr>
</tbody>
</table>
</div>
fiddle code
EDIT: I no want tabs, I will add our plans to site.
I update fiddle, I want remove this shadow on right side of tabs.

Your td tabs are positioned absolutely but relative to the div.bottom.
Easiest is to remove the z-index on the parent.
Fiddle: https://jsfiddle.net/abhitalks/bxzomqct/7/
Snippet:
div {
position: relative;
width: 70%;
margin: auto;
height: 500px;
background-color: red;
}
table {
border: none;
border-spacing: 0 11px;
width: 100%;
table-layout: fixed;
}
td.tab {
background-color: #eee;
padding: 15px;
width: 20%;
position: absolute;
z-index: -15;
right: 90%;
}
td.plan {
padding: 15px;
width: 33.3%;
text-align: center;
}
<div class="bottom">
<table>
<tbody>
<tr>
<td class="tab">test</td>
<td class="plan">test</td>
<td class="plan">test</td>
<td class="plan">test</td>
</tr>
<tr>
<td class="tab">test</td>
<td class="plan">test</td>
<td class="plan">test</td>
<td class="plan">test</td>
</tr>
<tr>
<td class="tab">test</td>
<td class="plan">test</td>
<td class="plan">test</td>
<td class="plan">test</td>
</tr>
</tbody>
</table>
</div>
Better still, to avoid confusions, Just wrap your entire construct in another div and position the tabs relative that outer div.
div.top {
position: relative;
width: 70%;
margin: auto;
}
div.bottom {
background-color: red; z-index: 50; height: 500px;
}
table {
border: none;
border-spacing: 0 11px;
width: 100%;
table-layout: fixed;
}
td.tab {
background-color: #eee;
padding: 15px;
width: 20%;
position: absolute;
z-index: -150;
right: 90%;
}
td.plan {
padding: 15px;
width: 33.3%;
text-align: center;
}
<div class="top">
<div class="bottom">
<table>
<tbody>
<tr>
<td class="tab">test</td>
<td class="plan">test</td>
<td class="plan">test</td>
<td class="plan">test</td>
</tr>
<tr>
<td class="tab">test</td>
<td class="plan">test</td>
<td class="plan">test</td>
<td class="plan">test</td>
</tr>
<tr>
<td class="tab">test</td>
<td class="plan">test</td>
<td class="plan">test</td>
<td class="plan">test</td>
</tr>
</tbody>
</table>
</div>
</div>
Your Fiddle: https://jsfiddle.net/abhitalks/bxzomqct/6/
Why this happens:
This is because of the stacking context that is generated by the positioned elements. Although, the stacking order within a stacking context specifies the negative z-index values to be painted first, it is however limited to that same stacking context.
Reference: https://www.w3.org/TR/CSS2/zindex.html
Reading: https://developer.mozilla.org/en-US/docs/Web/CSS/CSS_Positioning/Understanding_z_index/The_stacking_context
So, with a negative z-index, your tabs should appear behind its parents (div.bottom in this case). And it will, as it is in same stacking context.
However, as soon as you give a z-index value to the div.bottom, it creates a new stacking context which confines all of its child elements to a particular place in the stacking order. This causes it not to appear in front of the tabs irrespective of the z-index of tabs.
Note that the specs do not explain this verbatim, and has to be referred to with other references and docs to develop an understanding. It's tricky.
Here is a good article you can refer to: https://philipwalton.com/articles/what-no-one-told-you-about-z-index/

In your example, z-index won't work because you use it with two elements which are not in the same level in the DOM.
To make it works, you can place the two element with relative or absolute position in the same DOM level.
Doc about z-index: https://stackoverflow.com/a/2305711/6028607
div {
position: relative;
z-index: 5;
width: 70%;
margin: auto;
height: 500px;
background-color: red;
}
table {
border: none;
border-spacing: 0 11px;
width: 100%;
table-layout: fixed;
}
td.tab {
background-color: white;
padding: 15px;
width: 20%;
position: absolute;
z-index: -15;
right: 90%;
}
td.plan {
padding: 15px;
width: 33.3%;
text-align: center;
z-index: 0;
position: relative;
}
.test { z-index: 0; position: absolute; top: 200px; background:yellow; width: 100%; left: 0; height: 40px; padding: 10px; }
<div class="bottom">
<table>
<tbody>
<tr>
<td class="plan">test</td>
<td class="plan">test</td>
<td class="plan">test</td>
<td class="plan">test</td>
</tr>
<tr>
<td class="tab">test</td>
<td class="plan">test</td>
<td class="plan">test</td>
<td class="plan">test</td>
</tr>
<tr>
<td class="tab">test</td>
<td class="plan">test</td>
<td class="plan">test</td>
<td class="plan">test</td>
</tr>
</tbody>
</table>
</div>
<div class="test">test</div>

Related

Content inside a table cell doesn't take the whole space

I created this table:
table {
}
thead {
background-color: black;
color: white;
}
tbody, tr, td {
border: 1px solid black;
}
.cell-first-column {
width: 200px;
height: 70px;
}
.cell, th {
width: 100px;
height: 70px;
}
.td-cell {
height: 70px;
border: 1px solid black;
}
.chart {
position: relative;
width: 100%;
height: 100%;
display: flex;
justify-content: center;
align-items: center;
margin: 0
}
.chart-inner {
position: absolute;
top: 0;
bottom: 0;
left: 0;
right: 0;
background-color: gold;
}
.cell-text {
z-index: 10;
}
<table>
<thead>
<tr>
<th>Company</th>
<th>Contact</th>
<th>Country</th>
<th>Number</th>
</tr>
</thead>
<tr>
<td><div class="cell-first-column">Alfreds Futterkiste</div></td>
<td><div class="cell">Maria Anders</div></td>
<td><div class="cell">Germany</div></td>
<td><div class="cell">1234567</div></td>
</tr>
<tr>
<td><div class="cell-first-column">Centro comercial</div></td>
<td><div class="cell">Francisco Chang</div></td>
<td><div class="cell">Mexico</div></td>
<td><div class="cell">1234567</div></td>
</tr>
<tr>
<td><div class="cell-first-column">Opla</div></td>
<td class="td-cell">
<div class="chart">
<div class="chart-inner" style="height: 90%"></div>
<div class="cell-text">Charles Boule</div>
</div>
</td>
<td class="td-cell">
<div class="chart">
<div class="chart-inner" style="height: 30%"></div>
<div class="cell-text">France</div>
</div>
</td>
<td class="td-cell">
<div class="chart">
<div class="chart-inner" style="height: 50%"></div>
<div class="cell-text">1234567</div>
</div>
</td>
</tr>
</table>
inside the third row, the cells are colored and to do that I use absolute position.
It works but I don't understand why the yellow doesn't take the entire cell space, there is a white margin between the yellow and the cell border.
Margins are 0.
How it is now vs How I would like it to be:
Why? How can I solve?
Thanks a lot
Set padding of td to 0 should fix the issue.
The correct way:
<table cellpadding="0">

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.

Adjust spacing between HTML table rows

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>

Remove border spacing from every 2n element in table

I have a table that looks like this:
And every row has a hidden details field:
So I want to remove border spacing from row and its details row.. How can I do that?
this is my HTML:
<table class="table message-table">
<thead>
<tr>
<th>Title</th>
<th>Date</th>
<th>Action</th>
<th></th>
</tr>
</thead>
<tbody>
<ng-container *ngFor="let message of messages | paginate: config">
<tr>
<td>{{message.title}}</td>
<td>{{message.created | date:'longDate'}}</td>
<td (click)="message.collapsed = !message.collapsed; makeMessageSeen(message);" [attr.aria-expanded]="!message.collapsed" aria-controls="collapseExample">{{message.collapsed ? 'More' : 'Less'}}</td>
<td></td>
</tr>
<tr id="collapseExample" [ngbCollapse]="message.collapsed">
<td>{{message.text}}</td>
<td colspan="3"></td>
</tr>
</ng-container>
</tbody>
</table>
and this is my SCSS:
.messages {
background-color: $color-background-main;
min-height: 17rem;
overflow-x: auto;
padding-top: 2rem;
.message-table {
border-collapse: separate;
border-spacing: 0 0.4rem;
thead {
th {
border: none;
font-size: 0.6rem;
color: #9b9b9b;
text-transform: uppercase;
padding-top: 0;
padding-bottom: 0;
&:first-child {
width: 70%;
padding-left: 1rem;
}
}
}
}
tbody {
tr {
box-shadow: $main-shadow;
background-color: white;
&.selected {
box-shadow: $shadow-selected;
}
td:first-child {
padding-left: 1rem;
}
}
td {
background-color: white;
border: none;
padding-top: 0;
padding-bottom: 0;
padding-right: 0;
height: 2.5rem;
vertical-align: middle;
table-layout: fixed;
&:first-child {
border-top-left-radius: 5px;
border-bottom-left-radius: 5px;
}
&:last-child {
border-top-right-radius: 5px;
border-bottom-right-radius: 5px;
padding-right: 0;
width: 2rem;
}
}
}
}
How can I fix this? I've tried making tr a top border but nothing happened... What are other solutions for my problem?
UPDATE 1
Adding codepen of a simple example : https://codepen.io/anon/pen/prxgOe
UPDATE 2
I want to remove spacing between title and details tr elements ONLY!
Here is a quick fix using borders.
table {
border-collapse: collapse;
border-spacing: 0 0.4rem;
}
tr {
background-color: #ccc;
}
.title {
border-top: 5px solid #fff;
}
.details {
/* display: none; */
}
<table>
<thead>
<tr>
<th>Title</th>
<th>Created</th>
<th>Action</th>
</tr>
</thead>
<tbody>
<tr class="title">
<td>title1</td>
<td>2017-01-01</td>
<td>More</td>
</tr>
<tr class="details">
<td>this is text1</td>
<td colspan="2"></td>
</tr>
<tr class="title">
<td>title2</td>
<td>2017-01-01</td>
<td>More</td>
</tr>
<tr class="details">
<td>this is text2</td>
<td colspan="2"></td>
</tr>
<tr class="title">
<td>title3</td>
<td>2017-01-01</td>
<td>More</td>
</tr>
<tr class="details">
<td>this is text3</td>
<td colspan="2"></td>
</tr>
</tbody>
</table>
I think you want like this
table {
border-collapse: collapse;
border-spacing: 0 0.4rem;
}
tr {
background-color: #ccc;
display: table-row;
}
table {
border-collapse: collapse;
border-spacing: 0 0.4rem;
}
tr {
background-color: #ccc;
display: table-row;
}
.title:first-child {
border-top: 7px solid #fff;
}
.title {
border-top: 12px solid #fff;
}
tbody tr:nth-child(2n) {
position: relative;
}
tbody tr:nth-child(2n)::after {
bottom: 0;
box-shadow: 0 2px 2px 0 #ebebeb;
content: "";
height: 100%;
left: 0;
position: absolute;
right: 0;
width: 100%;
}
<table>
<thead>
<tr>
<th>Title</th>
<th>Created</th>
<th>Action</th>
</tr>
</thead>
<tbody>
<tr class="title">
<td>title1</td>
<td>2017-01-01</td>
<td>More</td>
</tr>
<tr class="details">
<td>this is text1</td>
<td colspan="2"></td>
</tr>
<tr class="title">
<td>title2</td>
<td>2017-01-01</td>
<td>More</td>
</tr>
<tr class="details">
<td>this is text2</td>
<td colspan="2"></td>
</tr>
<tr class="title">
<td>title3</td>
<td>2017-01-01</td>
<td>More</td>
</tr>
<tr class="details">
<td>this is text3</td>
<td colspan="2"></td>
</tr>
</tbody>
</table>
*ngFor has an option to detect odd and even rows:
<div *ngFor="let message of messages; let odd=odd; let even=even>..</div>
then you can use odd or even values to set style/class as so:
<div [class.evenClass]="event" [class.oddClass]="odd">...</div>
and in the stylesheet, define .evenClass and .oddClass style as needed.
P.S.You have a table layout, you need to adapt above to your case
#hunzaboy and #ankitapatel answers were kind of good for me, but eventually I came with different solution which is probably not the best one, but it works like a charm... It does not break the ui scalability or anything else...
So I just added div elements in each of td elements so my HTML now looks like this:
<tbody>
<ng-container *ngFor="let message of messages | paginate: config">
<tr>
<td [class.unseen]="!message.seen" [class.seen]="message.seen">{{message.title}}</td>
<td [class.unseen]="!message.seen" [class.seen]="message.seen">{{message.created | date:'longDate'}}</td>
<td class="details-button" (click)="message.collapsed = !message.collapsed; makeMessageSeen(message);" [attr.aria-expanded]="!message.collapsed" aria-controls="collapseExample">{{message.collapsed ? 'More' : 'Less'}}</td>
<td></td>
</tr>
<tr id="collapseExample" [ngbCollapse]="message.collapsed">
<td>
<div class="text-container">{{message.text}}</div>
</td>
<td colspan="3">
<div class="empty-container"></div>
</td>
</tr>
</ng-container>
</tbody>
and then I added this SCSS to my file:
#collapseExample {
td {
padding: 0;
}
.text-container {
background-color: #fff;
margin-top: -23px;
padding-left: 1rem;
border-radius: 0.2rem;
height: 100%;
padding-bottom: 1rem;
}
.empty-container {
background-color: #fff;
height: 100%;
margin-top: -20px;
width: 100%;
}
}

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.