I have a table which should not have multi-lines. So I was thinking of forcing the overflow being hidden and make overflow visible it on hover. However, the other text is still shining through the visible overflow. Is there a way to prevent this?
https://jsfiddle.net/60mj7gqb/1/
<table>
<tr>
<td style="height: 30px; width: 100px; border: 1px solid grey;">
<div style="width: 100px; overflow: hidden">
<span style="white-space: nowrap; padding: 5px;">myPreciousText is located here</span>
</div>
</td>
<td style="height: 30px; width: 100px; border: 1px solid grey;">
<div style="width: 100px; overflow: visible">
<span style="white-space: nowrap; padding: 5px; background: #afffcf">myPreciousText is located here</span>
</div>
</td>
<td style="height: 30px; width: 100px; border: 1px solid grey;">
<div style="width: 100px; overflow: hidden">
<span style="white-space: nowrap; padding: 5px;">myPreciousText is located here</span>
</div>
</td>
</tr>
</table>
You could add a z-index on hover (as well as your background-colour on the span):
div {
overflow: hidden;
}
div:hover {
position: relative;
z-index: 1;
overflow: visible;
}
div:hover span {
background: #afffcf;
}
<table>
<tr>
<td style="height: 30px; width: 100px; border: 1px solid grey;">
<div style="width: 100px; ">
<span style="white-space: nowrap; padding: 5px;">myPreciousText is located here</span>
</div>
</td>
<td style="height: 30px; width: 100px; border: 1px solid grey;">
<div style="width: 100px; ">
<span style="white-space: nowrap; padding: 5px; ">myPreciousText is located here</span>
</div>
</td>
<td style="height: 30px; width: 100px; border: 1px solid grey;">
<div style="width: 100px;">
<span style="white-space: nowrap; padding: 5px;">myPreciousText is located here</span>
</div>
</td>
</tr>
</table>
Related
I am trying to create UI as shown in attached image.
There are 2 parts leftside and rightside.
Here, Col1 and Col2 are fixed on leftside. On rightside Col3, Col4 and so on are dynamically added. Below Col3, Col4(rightside) there is scroll bar so that user can scroll and see right most columns info.
Issue that I am facing is due to variable text size inside cell. Due variable text inside each cell, height of cell gets different and in some time it looks like as shown in screenshot. It cuts. I want each cell to be of same height. The cell which have more text, height of that cell should be applied to other cells in row. But that is not happening only for "Col 2".
I think this is due to "position" CSS given to it. I am using below HTML and CSS to achieve this. I tried to solve it by CSS but not able to do it.
Any help/suggestion appreciated.
.table {
border: none;
border-right: solid 1px #e6e6e6;
border-bottom: solid 1px #e6e6e6;
border-collapse: separate;
border-spacing: 0;
font: normal 13px Arial, sans-serif;
}
.table thead th {
background-color: #F1F1F1;
border: none;
color: #000000;
padding: 10px 15px;
text-align: center;
min-width: 250px;
max-width: 250px;
border-top: 1px solid #e6e6e6;
border-left: 1px solid #e6e6e6;
font-size: 14px;
}
.table tbody td {
font-size: 12px;
border-left: solid 1px #e6e6e6;
border-top: solid 1px #e6e6e6;
background-color: #ffffff;
color: #000000;
padding: 10px 15px;
// text-shadow: 1px 1px 1px #fff;
white-space: normal;
min-width: 250px;
max-width: 250px;
}
.table tbody td:nth-child(1) {
background-color: #F1F1F1;
}
.table tbody td span {
float: left;
width: 100%;
word-break: break-all;
}
.wrapper {
position: relative;
background-color: #F1F1F1;
}
.scroller {
margin-left: 500px;
overflow-x: scroll;
}
.table .col1 {
left: 0;
position: absolute;
top: auto;
width: 120px;
height: auto;
background-color: #F3F3F3;
color: #000000;
text-transform: capitalize;
}
.table .col2 {
left: 250px;
position: absolute;
top: auto;
width: 120px;
height: auto;
color: #000000;
}
<div class="wrapper">
<div class="scroller">
<table class="table">
<thead>
<tr>
<th class="col1">Col 1</th>
<th class="col2">Col 2</th>
<th colspan="4"> </th>
</tr>
</thead>
<tbody>
<tr>
<td class="col1">
<span>
Item No.
</span>
</td>
<td class="col2">
<span>
NA
</span>
</td>
<td>
<span>
21312312
</span>
</td>
<td>
<span>
21312312
</span>
</td>
<td>
<span>
21312312
</span>
</td>
<td>
<span>
21312312
</span>
</td>
</tr>
<tr>
<td class="col1">
<span>
Item Description
</span>
</td>
<td class="col2">
<span>
ITM-Local-Create ITM-Local-Create ITM-Local-Create ITM-Local-CreateITM-Local-Create ITM-Local-Create ITM-Local-Create
</span>
</td>
<td>
<span>
ITM-Local-Create
</span>
</td>
<td>
<span>
ITM-Local-Create
</span>
</td>
<td>
<span>
ITM-Local-Create
</span>
</td>
<td>
<span>
ITM-Local-Create
</span>
</td>
</tr>
<tr>
<td class="col1">
<span>
Short Description
</span>
</td>
<td class="col2">
<span>
CABLE,ELEC;
</span>
</td>
<td>
<span>
CABLE,ELEC CABLE,ELEC;GL;1;2;3;422LKSDFKLK;LKJX CABLE,ELEC;GL;1;2;3;422LKSDFKLK;LKJX
</span>
</td>
<td>
<span>
CABLE,ELEC
</span>
</td>
<td>
<span>
CABLE,ELEC
</span>
</td>
<td>
<span>
CABLE,ELEC
</span>
</td>
</tr>
</tbody>
</table>
</div>
</div>
I have begun creating an OrgChart using HTML and CSS. One issue I have run into is creating an intersecting chart flow-line between <tr> and <td> elements.
I created container, vertical-line and horizontal-line definitions that I wrapped into <td> andtags. The vertical-line works correctly by cantering the line in the. I created a second` for the horizontal-line to intersect in the middle with the vertical-line. However, the line remains at the bottom.
I have added the CSS and HTML to my post and hope that one of you can help me on what I am doing wrong.
table {
border-collapse: collapse;
margin-left: auto;
margin-right: auto;
width: auto;
}
tr {
border: none;
}
th,
td {
border-collapse: collapse;
border: 1px solid black;
padding-top: 0;
padding-bottom: 0;
text-align: center;
width: 100;
}
div.container {
width: 40px;
}
div.vertical-line {
border-left: 1px solid red;
height: 55px;
margin-left: auto;
margin-right: auto;
width: 1px;
}
div.horizontal-line {
border-bottom: 1px solid red;
height: 1px;
margin-top: auto;
margin-bottom: auto;
width: 40px;
}
<table>
<tr>
<td style="background-color: goldenrod" colspan="3">
<div>Dept
</br>
<b>EmpName</b>
</div>
</td>
</tr>
<tr>
<td style="width: 42.5%; background-color: wheat">
<div>Dept
</br>
<b>EmpName</b>
</div>
</td>
<td style="width: 15%">
<div class="container">
<div class="vertical-line"> </div>
<div class="horizontal-line"> </div>
</div>
</td>
<td style="width: 42.5%">
<div style="background-color:#CCFFCC">Dept
</br>
<b>EmpName</b>
<div style="border-bottom: 1px solid">
</div>
<div style="background-color:#CCFFFF">Dept
</br>
<b>EmpName</b>
</div>
</td>
</tr>
</table>
Here's a workaround:
add another horizontal line before the vertical line:
<td style="width: 15%">
<div class="container">
<div class="horizontal-line"> </div>
<div class="vertical-line"> </div>
<div class="horizontal-line"> </div>
</div>
</td>
Then change the display of it's container to flex:
div.container {
display: flex;
width: 40px;
}
The following code works well in Chrome and IE, but does not working in Firefox.
The table is generated dynamically and tr/td can't be removed from the following example
.widget-table-container,
tr td {
border: 1px solid red;
}
.widget {
border: 1px solid green;
margin: 0px;
padding: 0px;
background-color: #ffffff;
border-radius: 5px;
overflow: hidden;
height: 100%;
width: 100%;
left: 1px;
top: 1px;
bottom: 0px;
right: 0px;
}
<table class="widget-table-container">
<tbody>
<tr>
<td colspan="2" rowspan="2" style="width: 378px; height: 378px;">
<div class="widget" style="width: 371px; height: 371px; background-color:lightblue;">
<div class="widget-title">
<p>Title</p>
</div>
<div class="widget-body"></div>
</div>
</td>
<td colspan="8" rowspan="4" style="width: 1512px; height: 756px;">
<div class="widget" style="width: 1493px; height: 745px;">
<div class="widget-title">Title CPU</p>
</div>
<div class="widget-body">BODY</div>
</div>
</td>
</tr>
<tr>
</tr>
<tr>
<td colspan="2" rowspan="2" style="width: 378px; height: 378px;">
<div class="widget" style="width: 371px; height: 371px;">
<div class="widget-title">
<p>Some Title</p>
</div>
<div class="widget-body"></div>
</div>
</td>
</tr>
<tr></tr>
</tbody>
</table>
I have removed last empty and it looks like fixed problem.
I'm not sure why only removing last tr fixed problem not all tr.
But i my case it is working, Thanks All for help.
I'm having a tiny issue where in my table I have gotten the entire TD clickable, and even managed to get the td:hover to work.
However I've come across a point where I need to have blocks that say "Incomplete" (because I don't know how to hide cells without messing up the block sizes). How can I fix it where the entire cell highlights but doesn't highlight the Incomplete ones?
td a:hover {
background: #c2ceb5;
display: block;
width: 100%;
height: 100%;
}
td a {
display: block;
width: 100%;
height: 100%;
}
td {
position: relative;
}
td a:before {
content: "";
position: absolute;
top: 0;
left: 0;
right: 0;
bottom: 0;
}
<table align="" style="border: 0px solid #ffffff; background-color: #5e913f;" class="mceEditable" border="1" cellpadding="5" cellspacing="0" height="207.75" width="1060">
<tbody>
<tr>
<td style="text-align: center; border: 5px solid #ffffff; width: 250px;">
<a class="" title="Super" href="http://handlingmod.jimdo.com/vehicle-list/super/adder/"><span style="color: #ffffff;">Adder</span></a>
</td>
<td style="text-align: center; border: 5px solid #ffffff; width: 250px;">
<a class="" title="Super" href="http://handlingmod.jimdo.com/vehicle-list/super/vacca/"><span style="color: #ffffff;">Vacca</span></a>
</td>
<td style="text-align: center; border: 5px solid #ffffff; width: 250px;">
<span style="color: #dddddd;">Uncomplete</span>
</td>
<td style="text-align: center; border: 5px solid #ffffff; width: 250px;">
<span style="color: #dddddd;">Uncomplete</span>
</td>
</tr>
<tr>
<td style="text-align: center; border: 5px solid #ffffff; width: 250px;">
<span style="color: #dddddd;">Uncomplete</span>
</td>
<td style="text-align: center; border: 5px solid #ffffff; width: 250px;">
<span style="color: #dddddd;">Uncomplete</span>
</td>
<td style="text-align: center; border: 5px solid #ffffff; width: 250px;">
<span style="color: #dddddd;">Uncomplete</span>
</td>
<td style="text-align: center; border: 5px solid #ffffff; width: 250px;">
<span style="color: #dddddd;">Uncomplete</span>
</td>
</tr>
<tr>
<td style="text-align: center; border: 5px solid #ffffff; width: 250px;">
<span style="color: #dddddd;">Uncomplete</span>
</td>
<td style="text-align: center; border: 5px solid #ffffff; width: 250px;">
<span style="color: #dddddd;">Uncomplete</span>
</td>
<td style="text-align: center; border: 5px solid #ffffff; width: 0px;">
<span style="color: #dddddd;">Uncomplete</span>
</td>
<td style="text-align: center; border: 5px solid #ffffff; width: 0px;">
<span style="color: #dddddd;">Uncomplete</span>
</td>
</tr>
</tbody>
</table>
<p>
<span style="color: #ffffff;"> </span>
</p>
See if this works - http://jsfiddle.net/2pfL7toz/
td {
position: relative;
line-height: 60px; /*a bit hacky but works*/
}
td a, td span {
position: absolute;
top: 0;
left: 0;
right: 0;
bottom: 0;
text-decoration: none;
}
td a:hover {
background: #c2ceb5;
}
How about this?
CSS:
td a:hover {
background: #c2ceb5;
display: block;
}
td a, td span {
position:absolute;
top:0;
left:0;
right:0;
bottom:0;
display: block;
padding-top:20px;
}
td {
position: relative;
}
Note: This solution degrades slightly if your text wraps within a cell.
This is an experiment I'm working on for a layout. I had a lot of issues positioning divs to achieve this effect, so I turned to the old standby, table cascades. My problem here is that that last upper box has extra padding in all 3 browsers and I cannot seem to CSS or HTML it away no matter what I try. The red boxes should be flush over the green bits you see surrounding them and there shouldn't be a 1px visible green line to the right of the blue row between the red boxes. Any insight would be extremely appreciated.
<!doctype html>
<html>
<head>
<style>
table { border-collapse: collapse; border-spacing: 0; padding: 0; margin: 0;}
td table { border-collapse: collapse; border-spacing: 0; padding: 0; margin: 0;}
img { display: block; }
</style>
</head>
<body style="background-color: black;">
<table style="background-color: white; height: 525px; width: 3200; padding-top: 25px; padding-bottom: 25px;">
<tr>
<td colspan="1" style="width: 350px;">
<table class="container" style="height: 475px; width: 350px; margin-left: 25px; margin-right: 25px;">
<tr>
<td style="background-color: green; height: 225px; width: 350px;" colspan="3">
</td>
</tr>
<tr>
<td style="background-color: blue; height: 25px; width: 350px;" colspan="3">
</td>
</tr>
<tr>
<td style="background-color: green; height: 200px; width: 175px;">
</td>
<td style="background-color: blue; height: 200px; width: 25px;">
</td>
<td style="background-color: green; height: 200px; width: 125px;">
</td>
</tr>
</table>
</td>
<td colspan="1" style="width: 125px;">
<table class="container" style="height: 475px; width: 125px; margin-right: 25px;">
<tr>
<td style="background-color: red; height: 475px; width: 125px;">
</td>
</tr>
</table>
</td>
<td colspan="1">
<table class="container" style="height: 475px; width: 450px; margin-right: 25px;">
<tr>
<td style="background-color: green; height: 25px; width: 225px;">
</td>
<td style="background-color: blue; height: 225px; width: 25px;" >
</td>
<td style="background-color: green; height: 225px; width: 225px;" >
</td>
</tr>
<tr>
<td style="background-color: blue; height: 25px; width: 450px;" colspan="3">
</td>
</tr>
<tr>
<td style="background-color: green; height: 200px; width: 450px;" colspan="3">
</td>
</tr>
</table>
</td>
<td colspan="1">
<table class="container" style="height: 475px; width: 400px; margin-right: 25px;">
<tr style="height: 225px;">
<td style="background-color: green; height: 225px; width: 275px;">
<table style="width: 100%; height: 225px;">
<tr>
<td style="height: 100px; width: 225px; background-color: red;">
</td>
</tr>
<tr>
<td style="background-color: blue; height: 25px; width: 225px;">
</td>
</tr>
<tr>
<td style="height: 100px; width: 225px; background-color: red;">
</td>
</tr>
</table>
</td>
<td style="background-color: blue; height: 225px; width: 25px;" >
</td>
<td style="background-color: green; height: 225px; width: 100px;" >
</td>
</tr>
<tr>
<td style="background-color: blue; height: 25px; width: 400px;" colspan="3">
</td>
</tr>
<tr>
<td style="background-color: green; height: 200px; width: 400px;" colspan="3">
</td>
</tr>
</table>
</td>
</table>
</td>
</table>
</body>
</html>
Do you mean this?
http://jsfiddle.net/Nq8Us/1/
I've edited your code and removed the extra 'padding' of green under red in question, by removing inline-styling, then added some styles in css pointing to the #problem_cell_table.
I suggest you remove all your inline styling and shift them to the stylesheet. Inline-styling overrides all stylesheet code. That's bad and also explains why you don't get any effect from stylesheet changes.
As to why there's a padding, it's because your main table's height that is wrapping all the rows, cells, and inner-tables, is higher than the declared row height added together. The cells in your all the rows automatically adjusts it's size to compensate for pixels that doesn't add up to your total declared of 525px.
In the example I've done, I "cheated" by setting css of the inner-table to height: 100% so it will expand to fit the height, should miscalculations occur.
Give me a moment, I'll add more to the <div> styling methods in my answer.
Edit:
Ok here my attempt at the layout using <div> and CSS. http://jsfiddle.net/XbFcJ/
Remember to use a CSS Reset Stylesheet first!
The CSS:
<style>
body{
background: black;
}
.wrapper{
}
.container{
width: 1500px;
}
.content-table {
border: 25px solid #fff;
overflow: hidden;
background: #fff;
}
.content-column {
margin-right: 25px;
float: left;
height: 475px;
}
.content-column.last {
margin-right: 0;
}
.first, .third, .last {
width: 425px;
background-color: green;
margin-right: 25px;
}
.top{
height: 225px;
border-bottom: 25px solid blue;
}
.left {
height: 225px;
width: 200px;
border-right: 25px solid blue;
}
.content-column.second {
width: 100px;
background-color: red;
}
.last .left {
background-color: red;
}
.last .left .top {
height: 100px;
border-bottom: 25px solid blue;
}
</style>
The HTML:
<body>
<div class="wrapper">
<div class="container">
<div class="content-table">
<div class="content-column first">
<div class="top">
</div>
<div class="bottom">
<div class="left">
</div>
</div>
</div>
<div class="content-column second">
</div>
<div class="content-column third">
<div class="top">
<div class="left">
</div>
</div>
<div class="bottom">
</div>
</div>
<div class="content-column last">
<div class="top">
<div class="left">
<div class="top">
</div>
</div>
</div>
<div class="bottom">
</div>
</div>
</div>
</div>
</div>
</body>