Hello I have a table and I made a tooltip with CSS
its shows up when u hover mouse on <td>
here's my jsfiddle : www.jsfiddle.net/4qzurb5w/
How can I make this tooltip always shows up everything in table?
Get rid of this block, it is conflicting:
.green:hover,
.blue:hover,
.red:hover,
.yellow:hover,
.black:hover {
opacity: 0.8;
}
It should work then.
I moved your opacity style to .tooltip .tooltiptext, see stack snippet.
.tooltip {
position: relative;
display: inline-block;
border-bottom: 1px dotted black;
}
.tooltip .tooltiptext {
visibility: hidden;
width: 120px;
background-color: black;
color: #fff;
text-align: center;
border-radius: 6px;
padding: 5px 0;
opacity: 0.8; /* <-- I added your opacity here */
/* Position the tooltip */
position: absolute;
z-index: 1;
top: 100%;
left: 50%;
margin-left: -60px;
}
.tooltip:hover .tooltiptext {
visibility: visible;
}
.div table {
font-family: Arial, Helvetica, sans-serif;
color: #666;
font-size: 10px;
text-shadow: 1px 1px 0px #fff;
background: #eaebec;
border: #ccc 1px solid;
-moz-border-radius: 3px;
-webkit-border-radius: 3px;
border-radius: 3px;
-moz-box-shadow: 0 1px 2px #d1d1d1;
-webkit-box-shadow: 0 1px 2px #d1d1d1;
box-shadow: 0 1px 2px #d1d1d1;
}
.div table caption {
font-weight: bold;
font-size: 11px;
}
.div td {
min-width: 100px;
text-align: center;
padding: 5px;
border-top: 1px solid #ffffff;
border-bottom: 1px solid #e0e0e0;
border-left: 1px solid #e0e0e0;
background: #fafafa;
background: -webkit-gradient(linear, left top, left bottom, from(#fbfbfb), to(#fafafa));
background: -moz-linear-gradient(top, #fbfbfb, #fafafa);
}
.red {
background: #940000 !important;
color: White !important;
text-shadow: 1px 1px 0px #000000;
}
.blue {
background: #1C2CFA !important;
color: White !important;
text-shadow: 1px 1px 0px #000000;
}
.black {
background: #000000 !important;
color: White !important;
text-shadow: 1px 1px 0px #000000;
}
.yellow {
background: #009999 !important;
color: Green !important;
text-shadow: 1px 1px 0px #000000;
}
.white {
background: #fafafa !important;
color: #666 !important;
}
.grey {
background: #808080 !important;
color: White !important;
text-shadow: 1px 1px 0px #000000;
}
.ariza {
background: #990000 !important;
color: White !important;
text-shadow: 1px 1px 0px #000000;
}
.green {
background: #00941C !important;
color: White !important;
text-shadow: 1px 1px 0px #000000;
}
.green:hover,
.blue:hover,
.red:hover,
.yellow:hover,
.black:hover {
/* opacity: 0.8; get rid of this */
}
.green a,
.blue a,
.red a,
.yellow a,
.black a {
display: block;
color: White;
text-decoration: none;
}
.yazitd {
width: 70px !important;
}
.sagtd {
width: 540px !important;
}
.tarihtd {
width: 160px !important;
}
.style3 {
width: 90px;
}
.style4 {
height: 19px;
}
.style5 {
width: 40px;
}
.style6 {
width: 40px;
height: 23px;
}
.style7 {
height: 23px;
}
<table>
<tbody>
<tr>
<td style="vertical-align: middle; min-width: 50px !important; font-weight: bold;">KAT 1 </td>
<td>
<table>
<tbody>
<tr>
<td style="vertical-align: top;">
</td>
</tr>
<tr>
<td class="red tooltip">Daire No:1
<div><span class="tooltiptext">ALEX DE SOUZA<br>HASAN ALİ KALDIRIM<br>ALPER POTUK<br>RIDVAN DİLMEN<br></span></div>
</td>
</tr>
</tbody>
</table>
</td>
<td>
<table>
<tbody>
<tr>
<td style="vertical-align: top;">
</td>
</tr>
<tr>
<td class="green tooltip">Daire No:2
<div><span class="tooltiptext"></span></div>
</td>
</tr>
</tbody>
</table>
</td>
<td>
<table>
<tbody>
<tr>
<td style="vertical-align: top;">
</td>
</tr>
<tr>
<td class="red tooltip">Daire No:3
<div><span class="tooltiptext">ALİ KOÇ<br></span></div>
</td>
</tr>
</tbody>
</table>
</td>
<td>
<table>
<tbody>
<tr>
<td style="vertical-align: top;">
</td>
</tr>
<tr>
<td class="green tooltip">Daire No:4
<div><span class="tooltiptext"></span></div>
</td>
</tr>
</tbody>
</table>
</td>
</tr>
<tr>
<td style="vertical-align: middle; min-width: 50px !important; font-weight: bold;">KAT 2 </td>
<td>
<table>
<tbody>
<tr>
<td style="vertical-align: top;">
</td>
</tr>
<tr>
<td class="green tooltip" style="font-weight: 400;">Daire No:5
<div><span class="tooltiptext"></span></div>
</td>
</tr>
</tbody>
</table>
</td>
<td>
<table>
<tbody>
<tr>
<td style="vertical-align: top;">
</td>
</tr>
<tr>
<td class="green tooltip">Daire No:6
<div><span class="tooltiptext"></span></div>
</td>
</tr>
</tbody>
</table>
</td>
<td>
<table>
<tbody>
<tr>
<td style="vertical-align: top;">
</td>
</tr>
<tr>
<td class="green tooltip">Daire No:7
<div><span class="tooltiptext"></span></div>
</td>
</tr>
</tbody>
</table>
</td>
<td>
<table>
<tbody>
<tr>
<td style="vertical-align: top;">
</td>
</tr>
<tr>
<td class="green tooltip">Daire No:8
<div><span class="tooltiptext"></span></div>
</td>
</tr>
</tbody>
</table>
</td>
</tr>
<tr>
<td style="vertical-align: middle; min-width: 50px !important; font-weight: bold;">KAT 3 </td>
<td>
<table>
<tbody>
<tr>
<td style="vertical-align: top;">
</td>
</tr>
<tr>
<td class="green tooltip">Daire No:9
<div><span class="tooltiptext"></span></div>
</td>
</tr>
</tbody>
</table>
</td>
<td>
<table>
<tbody>
<tr>
<td style="vertical-align: top;">
</td>
</tr>
<tr>
<td class="green tooltip">Daire No:10
<div><span class="tooltiptext"></span></div>
</td>
</tr>
</tbody>
</table>
</td>
<td>
<table>
<tr>
<td style="vertical-align: top;">
</td>
</tr>
<tr>
<td class="green tooltip">Daire No:11
<div><span class="tooltiptext"></span></div>
</td>
</tr>
</table>
</td>
<td>
<table>
<tbody>
<tr>
<td style="vertical-align: top;">
</td>
</tr>
<tr>
<td class="green tooltip">Daire No:12
<div><span class="tooltiptext"></span></div>
</td>
</tr>
</tbody>
</table>
</td>
</tr>
</tbody>
</table>
Related
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>
I want to replicate a table using CSS + HTML
So everything goes well until last part.
Table:
So I try:
#page {
background: #ffffff;
width: 878px;
margin: 0 auto;
margin-top: 40px;
display: block;
border: 1px solid #c4c7c7;
padding: 40px 40px 50px 40px;
position: relative;
z-index: 0;
}
.ship-table {
border-collapse: collapse;
}
.ship-table--title {
border-bottom: 3px solid;
border-top: 3px solid;
text-align: center;
background-color: #d3d3d3;
}
.ship-table--text_center {
text-align: center;
}
.ship-table--divider {
border-right: 3px solid;
border-left: 3px solid;
}
.ship-table--bottom {
border-bottom: 3px solid;
border-right: 3px solid;
}
.ship-table--image {
border-top: 3px solid;
border-right: 3px solid;
}
.ship-table--carrier {
background-color: #339933;
text-align: center;
}
.ship-table--due-box {
border: 3px solid;
}
.ship-table--dueDate {
background-color: #FFFF00;
}
.ship-table--dueDate_value {
font-size: 48px;
}
.ship-table--dueDate_field {
border: 3px solid;
border-color: red;
padding-bottom: 25px;
}
.ship-table--bol_value {
font-size: 28px;
}
<table class="ship-table">
<tbody>
<tr>
<td class="ship-table--title ship-table--divider">SHIP FROM</td>
<td class="ship-table--image" rowspan="2">pic here</td>
</tr>
<tr>
<td class="ship-table--divider">
{{ShipFromCompany}}
<br /> {{ShipFromAddressLineOne}}
<br /> {{ShipFromAddressLineTwo}}, {{ShipFromPostalCode}}
<br /> {{ShipFromAttn}}
<br /> {{ShipFromPhone}}
</td>
</tr>
<tr>
<td class="ship-table--title ship-table--divider">SHIP TO</td>
<td class="ship-table--title ship-table--divider">Carrier Name:</td>
</tr>
<tr>
<td class="ship-table--divider">
{{ShipToCompany}}
<br /> {{ShipToAddressLineOne}}
<br /> {{ShipToAddressLineTwo}}, {{ShipToPostalCode}}
<br /> {{ShipToAttn}}
<br /> {{ShipToPhone}}
</td>
<td class="ship-table--due-box">
<div class="ship-table--carrier ship-table--due-box ship-table--text_center">
{{ShipToCarrier}}
</div>
<div class="ship-table--dueDate ship-table--due-box ship-table--text_center">
DUE DATE:
</div>
<div class="ship-table--dueDate_value ship-table--dueDate_field ship-table--text_center">
{{ShipToDueDate}}
</div>
</td>
</tr>
<tr>
<td class="ship-table--title ship-table--divider">SHIPPER</td>
<td>
<div class="ship-table--title ship-table--divider">
BILL OF LADING NUMBER
</div>
<div class="ship-table--bol_value ship-table--text_center ship-table--divider">
{{BillOfLadingNumber}}
</div>
</td>
</tr>
<tr class="ship-table--bottom">
<td class="ship-table--divider">
{{ShipperCompany}}
<br /> {{ShipperAttn}}
<br /> {{ShipperAddressLineOne}}
<br /> {{ShipperAddressLineTwo}}
</td>
<td></td>
</tr>
</tbody>
</table>
How can I change nested borders to be part of the original colum, date be bigger than and the Bill Of ladding number at the bottom?
For nested borders I use border-colapse: colapse but it does not work.
Here is an easy solution. You can follow it.
#page {
background: #ffffff;
width: 878px;
margin: 0 auto;
margin-top: 40px;
display: block;
border: 1px solid #c4c7c7;
padding: 40px 40px 50px 40px;
position: relative;
z-index: 0;
}
.ship-table {
border-collapse: collapse;
width: 100%;
}
.ship-table tr, .ship-table td{
border: 1px solid #000;
}
.ship-table-table{
width: 100%;
}
.ship-table-table tr, .ship-table-table td{
border:0;
}
.ship-table--title {
border-bottom: 1px solid;
text-align: center;
background-color: #d3d3d3;
}
.ship-table--title-green{
border-top: 1px solid;
border-bottom: 1px solid;
text-align: center;
background-color: #339933;
}
.ship-table--title-yellow{
border-bottom: 1px solid;
text-align: center;
background-color: #FFFF00;
}
.ship-table--title-red{
border: 1px solid red !important;
text-align: center;
padding: 30px 0;
}
.ship-table--dueDate_value {
font-size: 48px;
text-align: center;
}
.ship-table--bol_value {
font-size: 28px;
text-align: center;
}
<div id="page">
<table class="ship-table" cellpadding="0" cellspacing="0">
<tr>
<td valign="top">
<table class="ship-table-table" cellpadding="0" cellspacing="0">
<tr>
<th class="ship-table--title">
SHIP FROM
</th>
</tr>
<tr>
<td>
{{ShipFromCompany}}
<br /> {{ShipFromAddressLineOne}}
<br /> {{ShipFromAddressLineTwo}}, {{ShipFromPostalCode}}
<br /> {{ShipFromAttn}}
<br /> {{ShipFromPhone}}
</td>
</tr>
</table>
</td>
<td>
pic here
</td>
</tr>
<tr>
<td valign="top">
<table class="ship-table-table" cellpadding="0" cellspacing="0">
<tr>
<th class="ship-table--title">
SHIP TO
</th>
</tr>
<tr>
<td>
{{ShipToCompany}}
<br /> {{ShipToAddressLineOne}}
<br /> {{ShipToAddressLineTwo}}, {{ShipToPostalCode}}
<br /> {{ShipToAttn}}
<br /> {{ShipToPhone}}
</td>
</tr>
</table>
</td>
<td valign="top" rowspan="2">
<table class="ship-table-table" cellpadding="0" cellspacing="0">
<tr>
<th class="ship-table--title">
Carrier Name:
</th>
</tr>
<tr>
<td>
CASC
</td>
</tr>
</table>
<table class="ship-table-table" cellpadding="0" cellspacing="0">
<tr>
<th class="ship-table--title-green">
{{ShipToCarrier}}
</th>
</tr>
<tr>
<th class="ship-table--title-yellow">
DUE DATE:
</th>
</tr>
<tr>
<td class="ship-table--title-red ship-table--dueDate_value">
{{ShipToDueDate}}
</td>
</tr>
</table>
<table class="ship-table-table" cellpadding="0" cellspacing="0">
<tr>
<th class="ship-table--title">
BILL OF LADING NUMBER
</th>
</tr>
<tr>
<td class="ship-table--bol_value">
{{BillOfLadingNumber}}
</td>
</tr>
</table>
</td>
</tr>
<tr>
<td valign="top">
<table class="ship-table-table" cellpadding="0" cellspacing="0">
<tr>
<th class="ship-table--title">
SHIPPER
</th>
</tr>
<tr>
<td>
{{ShipperCompany}}
<br /> {{ShipperAttn}}
<br /> {{ShipperAddressLineOne}}
<br /> {{ShipperAddressLineTwo}}
</td>
</tr>
</table>
</td>
</tr>
</table>
</div>
There is no neat way to do this. You have to rely on css hacks to fix the borders. Also I couldn't fix bottom right corner cell
Here's a temporary fix to the nested border issue (except for the last column in the lastrow)
Changes have been highlighted with comments (Also note, I do not recommend this method, I am just giving you an idea of the nested border issue and tricks to overlap them)
<!DOCTYPE html>
<html>
<head>
<title>Page Title</title>
<style>
#page {
background: #ffffff;
width: 878px;
margin: 0 auto;
margin-top: 40px;
display: block;
border: 1px solid #c4c7c7;
padding: 40px 40px 50px 40px;
position: relative;
z-index: 0;
}
.ship-table {
border-collapse: collapse;
}
.ship-table--title {
border-bottom: 3px solid;
border-top: 3px solid;
text-align: center;
background-color: #d3d3d3;
}
.ship-table--text_center {
text-align: center;
}
.ship-table--divider {
border-right: 3px solid;
border-left: 3px solid;
}
.ship-table--bottom {
border-bottom: 3px solid;
border-right: 3px solid;
}
.ship-table--image {
border-top: 3px solid;
border-right: 3px solid;
}
.ship-table--carriership-table--carrier {
background-color: #339933;
text-align: center;
}
.ship-table--due-box {
border-right: 3px solid; /*changes */
}
.ship-table--carrier {
border-right:none; /* changes*/
}
.ship-table--dueDate {
background-color: #FFFF00;
border-right: none; /*changes*/
}
.ship-table--dueDate_value {
font-size: 48px;
/*changes*/
position: relative;
margin-left: -4px;
margin-right: -4px;
margin-bottom: -2px;
}
.ship-table--dueDate_field {
border: 3px solid;
border-color: red;
padding-bottom: 25px;
}
.ship-table--bol_value {
font-size: 28px; /*changes*/
border-left: none;
position: relative;
margin-right: -2px;
}
.table-border-fix { /* new class to fix the borders in bottom column*/
border: 3px solid;
position: relative;
margin-left: -4px;
margin-right: -2px;
border-top: none;
}
</style>
</head>
<body>
<table class="ship-table">
<tbody>
<tr>
<td class="ship-table--title ship-table--divider">SHIP FROM</td>
<td class="ship-table--image" rowspan="2">pic here</td>
</tr>
<tr>
<td class="ship-table--divider">
{{ShipFromCompany}}
<br /> {{ShipFromAddressLineOne}}
<br /> {{ShipFromAddressLineTwo}}, {{ShipFromPostalCode}}
<br /> {{ShipFromAttn}}
<br /> {{ShipFromPhone}}
</td>
</tr>
<tr>
<td class="ship-table--title ship-table--divider">SHIP TO</td>
<td class="ship-table--title ship-table--divider">Carrier Name:</td>
</tr>
<tr>
<td class="ship-table--divider">
{{ShipToCompany}}
<br /> {{ShipToAddressLineOne}}
<br /> {{ShipToAddressLineTwo}}, {{ShipToPostalCode}}
<br /> {{ShipToAttn}}
<br /> {{ShipToPhone}}
</td>
<td class="ship-table--due-box">
<div class="ship-table--carrier ship-table--due-box ship-table--text_center">
{{ShipToCarrier}}
</div>
<div class="ship-table--dueDate ship-table--due-box ship-table--text_center">
DUE DATE:
</div>
<div class="ship-table--dueDate_value ship-table--dueDate_field ship-table--text_center">
{{ShipToDueDate}}
</div>
</td>
</tr>
<tr>
<td class="ship-table--title ship-table--divider">SHIPPER</td>
<td>
<!-- introduced new class table-border-fix to below 2 divs-->
<div class="ship-table--title ship-table--divider table-border-fix">
BILL OF LADING NUMBER
</div>
<div class="ship-table--bol_value ship-table--text_center ship-table--divider">
{{BillOfLadingNumber}}
</div>
</td>
</tr>
<tr class="ship-table--bottom">
<td class="ship-table--divider">
{{ShipperCompany}}
<br /> {{ShipperAttn}}
<br /> {{ShipperAddressLineOne}}
<br /> {{ShipperAddressLineTwo}}
</td>
</body>
</html>
References: Nested divs: how can I get overlapping borders?
I'm using opacity parametr for rgba color and only last-child element provides the color i want, every other border displays different color. You can even test it by colorpicker in devtools.
body {
background-color: black;
}
.content > table {
width: 100%;
border-collapse: collapse;
color: white;
}
.content > table > tbody > tr.topic {
height: 50px;
border-bottom: 1px solid rgba(16, 151, 255, 0.41);
}
<div class="content">
<table>
<tbody>
<tr class="topic">
<td class="topic-title">
<i class="topic-icon"></i>
Title
</td>
<td class="topic-replies">
<i class="replies-icon"></i>
15
</td>
<td class="topic-author">
Name
</td>
<td class="topic-timestamp">
<time>20m.</time>
</td>
</tr>
<tr class="topic">
<td class="topic-title">
<i class="topic-icon"></i>
Title
</td>
<td class="topic-replies">
<i class="replies-icon"></i>
15
</td>
<td class="topic-author">
Name
</td>
<td class="topic-timestamp">
<time>20m.</time>
</td>
</tr>
<tr class="topic">
<td class="topic-title">
<i class="topic-icon"></i>
Title
</td>
<td class="topic-replies">
<i class="replies-icon"></i>
15
</td>
<td class="topic-author">
Name
</td>
<td class="topic-timestamp">
<time>20m.</time>
</td>
</tr>
</tbody>
</table>
</div>
It seems to me a bug in chrome browser.
An alternate approach would be to use background-image instead of border-bottom.
We can use linear-gradient() to achieve the same effect.
.content > table > tbody > tr.topic {
background-image: linear-gradient(rgba(16, 151, 255, 0.41), rgba(16, 151, 255, 0.41));
background-repeat: no-repeat;
background-position: left bottom;
background-size: 100% 1px;
}
Working Demo:
body {
background-color: black;
}
.content > table {
width: 100%;
border-collapse: collapse;
color: white;
}
.content > table > tbody > tr.topic {
height: 50px;
background-image: linear-gradient(rgba(16, 151, 255, 0.41), rgba(16, 151, 255, 0.41));
background-repeat: no-repeat;
background-position: left bottom;
background-size: 100% 1px;
}
<div class="content">
<table>
<tbody>
<tr class="topic">
<td class="topic-title">
<i class="topic-icon"></i>
Title
</td>
<td class="topic-replies">
<i class="replies-icon"></i>
15
</td>
<td class="topic-author">
Name
</td>
<td class="topic-timestamp">
<time>20m.</time>
</td>
</tr>
<tr class="topic">
<td class="topic-title">
<i class="topic-icon"></i>
Title
</td>
<td class="topic-replies">
<i class="replies-icon"></i>
15
</td>
<td class="topic-author">
Name
</td>
<td class="topic-timestamp">
<time>20m.</time>
</td>
</tr>
<tr class="topic">
<td class="topic-title">
<i class="topic-icon"></i>
Title
</td>
<td class="topic-replies">
<i class="replies-icon"></i>
15
</td>
<td class="topic-author">
Name
</td>
<td class="topic-timestamp">
<time>20m.</time>
</td>
</tr>
</tbody>
</table>
</div>
wow pretty much seems like webkit having issues displaying that border properly.
You can try box-shadow on those rows instead:
.content > table > tbody > tr.topic {
box-shadow: 0px 1px rgba(16, 151, 255, 0.41);
}
This is a known bug (see https://bugs.chromium.org/p/chromium/issues/detail?id=312121)
Your choice is to either leave the alpha settings as they are since other browsers should be rendering it correctly and await the fix or to just use rgb values for the time being.
Or as ~Laszlo has suggested, use a box-shadow.
<th>Title <i class="sort-by" data-sort-type="-1"></i></th>
/*sorting Icons*/
th i.sort-by {
padding-right: 18px;
position: relative;
cursor:pointer;
}
th i.sort-by:before,
th i.sort-by:after {
border: 4px solid transparent;
content: "";
display: block;
height: 0;
right: 5px;
top: 50%;
position: absolute;
width: 0;
}
th i.sort-by[data-sort-type="0"]:before {
border-bottom-color: #999;
margin-top: -9px;
}
th i.sort-by[data-sort-type="1"]:before {
border-bottom-color: #03a9f4;
margin-top: -9px;
}
th i.sort-by[data-sort-type="-1"]:before {
border-bottom-color: #999;
margin-top: -9px;
}
th i.sort-by:after {
border-top-color: #999;
margin-top: 1px;
}
th i.sort-by[data-sort-type="-1"]:after {
border-top-color: #03a9f4;
margin-top: 1px;
}
$('i.sort-by').click(function(){
// alert($(this).attr("data-sort-type"));
if($(this).attr("data-sort-type") == 0){
$(this).attr("data-sort-type", 1);
}
else if($(this).attr("data-sort-type") == 1){
$(this).attr("data-sort-type", -1);
}
else{
$(this).attr("data-sort-type", 0);
}
});
I'm creating an e-mail template to send out but for some reason, I am unable to create two simple columns in the footer area.
Layout:
Code:
<div style="width: 100%; height: 100%;">
<table style="margin: 0px auto 0px auto; padding: 20px 20px 20px 20px; font: normal 10.5px; color: #777777; width: 100%; height: 100%;" align="center">
<tbody>
<tr>
<td>
<table class="content" style="background: none repeat scroll 0% 0% #FFFFFF; box-shadow: 0px 1px 2px rgba; width: 600px; max-width: 600px; margin: 0px auto;" cellspacing="0" cellpadding="0" align="center" bgcolor="#FFFFFF">
<thead>
<tr style="display: inline-block; width: 100%; background: #1F1F1F;" bgcolor="#1F1F1F">
<td style="width: 100%;" align="left" valign="middle">
<h1 style="padding: 15px 15px 15px 15px; color: #FFFFFF;">Test</h1>
</td>
<td style="border-left: 1px solid #FFFFFF;" align="right">
<table cellspacing="0" cellpadding="0">
<tbody>
<tr>
<td style="text-decoration: none; color: #ffffff; text-align: center; padding: 15px 15px 15px 15px; border-bottom: 1px solid #FFFFFF; font-family: Helvetica, Arial, Verdana; font-size: 8px; letter-spacing: 1.5px;">test</td>
</tr>
<tr>
<td style="text-decoration: none; color: #ffffff; text-align: center; padding: 15px 15px 15px 15px; font-family: Helvetica, Arial, Verdana; font-size: 8px; letter-spacing: 1.5px;">test</td>
</tr>
</tbody>
</table>
</td>
</tr>
</thead>
<tbody>
<tr>
<td> </td>
</tr>
<tr>
<td> </td>
</tr>
<tr>
<td>
<h4 style="color: #27ccc0; text-align: center; padding: 15px 15px 0px 15px;"> </h4>
</td>
</tr>
<tr>
<td> </td>
</tr>
</tbody>
<tfoot>
<tr>
<td>test</td>
<td>test</td>
</tr>
</tfoot>
</table>
</td>
</tr>
</tbody>
</table>
How do I modify the above code to create two simple columns in the footer area, that is still within the e-mail's container?
You should make simple structure of html,
Don't make table in table. You can use rowspan. HTML <th> rowspan Attribute
cells in thead tag, recommend to use th tag HTML <thead> Tag
Don't use this style display:inline-block; on tr tag
Put color style on tr tag if cells doesn't have different color
<div style="width: 100%; height: 100%;">
<table class="content" style="background: none; box-shadow: 0px 1px 2px rgba; width: 600px; max-width: 600px; margin: 0px auto;" cellspacing="0" cellpadding="0" align="center" bgcolor="#FFFFFF">
<thead>
<tr style="width: 100%; background: #1F1F1F;color: #FFFFFF;">
<th style="width: 100%;" align="left" valign="middle" rowspan=2>
<h1 style="padding: 15px 15px 15px 15px;">test</h1>
</th>
<th style="border-left: 1px solid #FFFFFF;border-bottom: 1px solid #FFFFFF;text-decoration: none;text-align: center; padding: 15px 15px" align="right">
test
</th>
</tr>
<tr style="width: 100%; background: #1F1F1F;color: #ffffff; ">
<th style="border-left: 1px solid #FFFFFF;text-decoration: none; text-align: center; padding: 15px 15px" align="right">
test
</th>
</tr>
</thead>
<tbody>
<tr>
<td style="background: red;" colspan="2"> </td>
</tr>
<tr>
<td style="background: red;" colspan="2"> </td>
</tr>
<tr>
<td style="background: red;" colspan="2">
<h4 style="color: #27ccc0; text-align: center; padding: 15px 15px 0px 15px;"> </h4>
</td>
</tr>
<tr>
<td style="background: red;" colspan="2"> </td>
</tr>
</tbody>
<tfoot>
<tr style="width: 100%; background: #1F1F1F; color: #ffffff;">
<td>test</td>
<td>test</td>
</tr>
</tfoot>
</table>
</div>
jsfiddle
I have a Table with content and i cannot figure out how to align the content of the spans inside the table.
HERE IS THE FIDDLE
Here is have pasted 2 images. 1st image is actual result and second is desired result.I think that explains it all...
CODE:
<table width="100%" cellspacing="3" cellpadding="0" style="border: 1px solid black; border-collapse: collapse; font-family: arial; font-size: 12px;">
<thead>
<tr style="background-color: #d3d3d3;">
<td colspan="2" style="padding: 5px; font-weight: bold;">Order Details</td>
</tr>
</thead>
<tbody>
<tr>
<td style="padding: 5px 0px 0px 5px; font-weight: bold; border-right-width: 1px; border-right-style: solid; border-right-color: #d3d3d3; width: 60%;">Order ID: <span style="font-weight: normal;text-align">#YCKY141</span>
</td>
<td style="padding-left: 20px; font-weight: bold;">Email: <span style="font-weight: normal;">wyz#ymca.com</span></td>
</tr>
<tr>
<td style="padding-left: 5px; font-weight: bold; border-right-width: 1px; border-right-style: solid; border-right-color: #d3d3d3; width: 60%;">Date: <span style="font-weight: normal;">28/03/2014</span>
</td>
<td style="padding-left: 20px; font-weight: bold;">Telephone: <span style="font-weight: normal;">XXX-XXX-XXXX</span>
</td>
</tr>
<tr>
<td style="padding-left: 5px; font-weight: bold; border-right-width: 1px; border-right-style: solid; border-right-color: #d3d3d3; width: 60%;">Payment Method: <span style="font-weight: normal;">On Invoice</span>
</td>
</tr>
<tr>
<td style="padding: 0px 0px 5px 5px; font-weight: bold; border-right-width: 1px; border-right-style: solid; border-right-color: #d3d3d3; width: 60%;">Shipping Method: <span style="font-weight: normal;">Royal Mail</span>
</td>
<td style="padding-left: 20px;"></td>
</tr>
</tbody>
</table>
Little bit changes you have to apply to your table.
have a look at Demo
HTML
<table width="100%" cellspacing="3" cellpadding="0" style="border: 1px solid black; border-collapse: collapse; font-family: arial; font-size: 12px;">
<thead>
<tr style="background-color: #d3d3d3;">
<td colspan="2" style="padding: 5px; font-weight: bold;">Order Details</td>
</tr>
</thead>
<tbody>
<tr>
<td style="border-right-style: solid; border-right-color: #d3d3d3; border-width:1px">
<table>
<tr>
<td style="padding: 5px 0px 0px 5px; font-weight: bold; ; width: 60%;">Order ID:
</td>
<td style="padding-left: 20px;"><span style="font-weight: normal; text-align">#YCKY141</span></td>
</tr>
<tr>
<td style="padding: 0px 0px 5px 5px; font-weight: bold; width: 60%;">Date:
</td>
<td style="padding-left: 20px;"><span style="font-weight: normal;">28/03/2014</span></td>
</tr>
<tr>
<td style="padding: 0px 0px 5px 5px; font-weight: bold; width: 60%;">payment Method:
</td>
<td style="padding-left: 20px;"><span style="font-weight: normal;">OnInvoice</span></td>
</tr>
<tr>
<td style="padding: 0px 0px 5px 5px; font-weight: bold; width: 60%;">Shipping Method:
</td>
<td style="padding-left: 20px;"><span style="font-weight: normal;">Royal Mail</span></td>
</tr>
</table>
</td>
<td style="vertical-align:top">
<table>
<tr>
<td>Email :
</td>
<td>
<span style="font-weight: normal;">wyz#ymca.com</span>
</td>
</tr>
<tr>
<td>Telephone:
</td>
<td>
<span style="font-weight: normal;">XXX-XXX-XXXX</span>
</td>
</tr>
</table>
</td>
</tr>
</tbody>
</table>
You just need to use a proper table layout:
<table>
<thead>
<tr>
<td colspan="4" class="headline">Order Details</td>
</tr>
</thead>
<tbody>
<tr>
<td class="first">Order ID:</td>
<td class="second">#YCKY141</td>
<td class="third"></td>
<td class="fourth"></td>
</tr>
<tr>
<td class="first">Date:</td>
<td class="second">2014-03-28</td>
<td class="third">Email</td>
<td class="fourth">wyz#ymca.com</td>
</tr>
</tbody>
</table>
CSS:
body {
font-family: Arial;
font-size: 12px;
}
table {
border: 1px solid #000;
border-collapse: collapse;
}
.headline {
background-color: #d3d3d3;
font-weight: bold;
padding: 5px;
}
.first,
.third {
font-weight: bold;
padding: 0 5px;
width: 20%;
}
.second,
.fourth {
width: 30%;
}
.third {
border-left: 1px solid #d3d3d3;
}
Demo: http://jsfiddle.net/kZ7Hj/
Wrap each key (Order Id, Date, etc.) in a span with display:inline-block and a width.
Example:
<span style="display:inline-block;width:40%;">Order Id</span>
Edit: Be sure to remove the inline styles when you're done experimenting. It'll make maintenance and debugging a lot easier. Just saw your comment about this being for an email template. I haven't looked at css support in email clients in some time and display:inline-block might not be supported.
I'm not sure if that is what you want but I applied :
<div style="width:200px; display:inline-block;">..</div>
on labels and it seems to be aligned just fine.
Here you can find an example: http://jsfiddle.net/LxD9N/12/
Replace the <span> element with an extra <td> element and align it.