I am creating a table as below and want to use display:grid. But for some reason, the styles within the grid items are not being applied. Any idea what I am doing wrong?
table {
border-collapse: collapse;
width: 100%;
table-layout: auto;
display: grid;
grid-template-columns: 1fr 1fr min-content;
}
thead,
tbody,
tr {
display: contents;
}
tbody {
overflow: auto;
}
thead {
font-weight: bold;
border-bottom: 1px solid #ccc;
}
th,
td {
padding: 15px;
overflow: hidden;
text-overflow: ellipsis;
white-space: nowrap;
}
th {
position: sticky;
top: 0;
padding: 0 4px 0 8px;
text-align: left;
position: relative;
}
tr {
line-height: 1.5;
border: none;
border-collapse: none;
height: 40px;
min-height: 40px;
}
tr:nth-child(2n){
background-color: pink;
}
tr:hover {
background-color: red;
}
td {
min-height: 40px;
height: 40px;
padding: 8px;
text-align: left;
}
<table class="list" role="grid">
<thead>
<tr role="row">
<th role="columnheader">Date</th>
<th role="columnheader">Action</th>
<th role="columnheader">Comments</th>
</tr>
</thead>
<tbody>
<tr role="row">
<td role="gridcell">1584748800000</td>
<td role="gridcell">DISMISS</td>
<td role="gridcell">gt</td>
</tr>
<tr role="row">
<td role="gridcell">1584662400000</td>
<td role="gridcell">DISMISS</td>
<td role="gridcell">asdasdsadasdsa</td>
</tr>
<tr role="row">
<td role="gridcell">1584576000000</td>
<td role="gridcell">DISMISS</td>
<td role="gridcell">fdgfdgdf</td>
</tr>
<tr role="row">
<td role="gridcell">1584144000000</td>
<td role="gridcell">ACCEPT</td>
<td role="gridcell">asdasdsadsadsadsa</td>
</tr>
<tr role="row">
<td role="gridcell">1583539200000</td>
<td role="gridcell">ACCEPT</td>
<td role="gridcell">asdasdsadsa</td>
</tr>
<tr role="row">
<td role="gridcell">1583452800000</td>
<td role="gridcell">DISMISS</td>
<td role="gridcell">asdasdsadsa</td>
</tr>
<tr role="row">
<td role="gridcell">1583366400000</td>
<td role="gridcell">DISMISS</td>
<td role="gridcell">asdasdasdsadsadsadsa</td>
</tr>
<tr role="row">
<td role="gridcell">1583280000000</td>
<td role="gridcell">DISMISS</td>
<td role="gridcell">aadasdsadsa</td>
</tr>
<tr role="row">
<td role="gridcell">1583193600000</td>
<td role="gridcell">DISMISS</td>
<td role="gridcell">asdas</td>
</tr>
<tr role="row">
<td role="gridcell">1583107200000</td>
<td role="gridcell">DISMISS</td>
<td role="gridcell">asd</td>
</tr>
</tbody>
</table>
I just cleaned your code.
table {
border-collapse: collapse;
width: 100%;
}
th {
text-align: left;
padding: 8px;
background-color: gray;
border: 1px solid black;
}
td {
text-align: left;
padding: 8px;
border: 1px solid black;
}
tr:nth-child(even) {
background-color: pink;
}
td:hover {
background-color: red;
}
td {
min-height: 40px;
height: 40px;
padding: 8px;
text-align: left;
}
<table class="list" role="grid">
<thead>
<tr role="row">
<th role="columnheader">Date</th>
<th role="columnheader">Action</th>
<th role="columnheader">Comments</th>
</tr>
</thead>
<tbody>
<tr role="row">
<td role="gridcell">1584748800000</td>
<td role="gridcell">DISMISS</td>
<td role="gridcell">gt</td>
</tr>
<tr role="row">
<td role="gridcell">1584662400000</td>
<td role="gridcell">DISMISS</td>
<td role="gridcell">asdasdsadasdsa</td>
</tr>
<tr role="row">
<td role="gridcell">1584576000000</td>
<td role="gridcell">DISMISS</td>
<td role="gridcell">fdgfdgdf</td>
</tr>
<tr role="row">
<td role="gridcell">1584144000000</td>
<td role="gridcell">ACCEPT</td>
<td role="gridcell">asdasdsadsadsadsa</td>
</tr>
<tr role="row">
<td role="gridcell">1583539200000</td>
<td role="gridcell">ACCEPT</td>
<td role="gridcell">asdasdsadsa</td>
</tr>
<tr role="row">
<td role="gridcell">1583452800000</td>
<td role="gridcell">DISMISS</td>
<td role="gridcell">asdasdsadsa</td>
</tr>
<tr role="row">
<td role="gridcell">1583366400000</td>
<td role="gridcell">DISMISS</td>
<td role="gridcell">asdasdasdsadsadsadsa</td>
</tr>
<tr role="row">
<td role="gridcell">1583280000000</td>
<td role="gridcell">DISMISS</td>
<td role="gridcell">aadasdsadsa</td>
</tr>
<tr role="row">
<td role="gridcell">1583193600000</td>
<td role="gridcell">DISMISS</td>
<td role="gridcell">asdas</td>
</tr>
<tr role="row">
<td role="gridcell">1583107200000</td>
<td role="gridcell">DISMISS</td>
<td role="gridcell">asd</td>
</tr>
</tbody>
</table>
Related
I currently have following implementatin where I want the body of the table to be scrollable. However, the column widths are all of equal width and I am trying to figure out how to achieve a flexible tablecell width based on content, while keeping the body's scrolling. ideas?
.modal {
height: 300px;
}
.first {
height: 100%;
}
table.list {
border-collapse: collapse;
width: 100%;
height: 100%;
}
thead,
tbody tr {
display: table;
width: 100%;
table-layout: fixed;
}
thead {
font-weight: bold;
border-bottom: 1px solid #ccc;
height: 40px;
}
th {
padding: 0 $now-global-space--sm 0 $now-global-space--md;
text-align: left;
word-break: break-word;
hyphens: auto;
}
tbody {
overflow: auto;
display: block;
height: calc(100% - 40px);
}
tr {
line-height: 1.5;
border: none;
border-collapse: none;
min-height: 40px;
}
td {
min-height: 40px;
min-width: 40px;
padding: 4px;
text-align: left;
word-break: break-word;
hyphens: auto;
}
tr:nth-child(2n) td {
background-color: red;
}
tr:hover td {
background-color: pink;
}
<div class="modal">
<div class="first">
<table class="list" role="grid">
<thead>
<tr role="row">
<th role="columnheader">Date</th>
<th role="columnheader">Action</th>
<th role="columnheader">Comment</th>
</tr>
</thead>
<tbody>
<tr role="row">
<td role="gridcell">Mar 24</td>
<td role="gridcell">somoene</td>
<td role="gridcell">ddddd</td>
</tr>
<tr role="row">
<td role="gridcell">Mar 23</td>
<td role="gridcell">someone</td>
<td role="gridcell">ddddd</td>
</tr>
<tr role="row">
<td role="gridcell">Mar 22</td>
<td role="gridcell">someone</td>
<td role="gridcell">dd</td>
</tr>
<tr role="row">
<td role="gridcell">Mar 21</td>
<td role="gridcell">someone</td>
<td role="gridcell">asd</td>
</tr>
<tr role="row">
<td role="gridcell">Mar 20</td>
<td role="gridcell">someone</td>
<td role="gridcell">asdasdsadasdsa</td>
</tr>
<tr role="row">
<td role="gridcell">Mar 14</td>
<td role="gridcell">someone</td>
<td role="gridcell">asdasdsadsadsadsa</td>
</tr>
<tr role="row">
<td role="gridcell">Mar 7</td>
<td role="gridcell">lala</td>
<td role="gridcell">asdasdsadsa</td>
</tr>
</tbody>
</table>
</div>
</div>
javascript, dispay:grid/contents could be options, but a wrapper and position:sticky could be a compromise to avoid breaking the table-layout , here is below a demo of the idea
.modal {
height: 300px;
border:solid;
}
.first {
height: 100%;
position: relative;
overflow: auto;
}
table.list {
border-collapse: collapse;
width: 100%;
height: 100%;
}
thead {
font-weight: bold;
border-bottom: 1px solid #ccc;
height: 40px;
}
thead tr {
position: sticky;
top: 0;
background: white;
box-shadow: 0 0 5px;
}
th {
text-align: left;
word-break: break-word;
hyphens: auto;
}
tr {
line-height: 1.5;
}
td {
height: 40px;
width: 40px;
padding: 4px;
text-align: left;
word-break: break-word;
hyphens: auto;
}
tr:nth-child(2n) td {
background-color: red;
}
tr:hover td {
background-color: pink;
}
<div class="modal">
<div class="first">
<table class="list" role="grid">
<thead>
<tr role="row">
<th role="columnheader">Date</th>
<th role="columnheader">Action</th>
<th role="columnheader">Comment</th>
</tr>
</thead>
<tbody>
<tr role="row">
<td role="gridcell">Mar 24</td>
<td role="gridcell">somoene</td>
<td role="gridcell">ddddd</td>
</tr>
<tr role="row">
<td role="gridcell">Mar 23</td>
<td role="gridcell">someone</td>
<td role="gridcell">ddddd</td>
</tr>
<tr role="row">
<td role="gridcell">Mar 22</td>
<td role="gridcell">someone</td>
<td role="gridcell">dd</td>
</tr>
<tr role="row">
<td role="gridcell">Mar 21</td>
<td role="gridcell">someone</td>
<td role="gridcell">asd</td>
</tr>
<tr role="row">
<td role="gridcell">Mar 20</td>
<td role="gridcell">someone</td>
<td role="gridcell">asdasdsadasdsa</td>
</tr>
<tr role="row">
<td role="gridcell">Mar 14</td>
<td role="gridcell">someone</td>
<td role="gridcell">asdasdsadsadsadsa</td>
</tr>
<tr role="row">
<td role="gridcell">Mar 24</td>
<td role="gridcell">somoene</td>
<td role="gridcell">ddddd</td>
</tr>
<tr role="row">
<td role="gridcell">Mar 23</td>
<td role="gridcell">someone</td>
<td role="gridcell">ddddd</td>
</tr>
<tr role="row">
<td role="gridcell">Mar 22</td>
<td role="gridcell">someone</td>
<td role="gridcell">dd</td>
</tr>
<tr role="row">
<td role="gridcell">Mar 21</td>
<td role="gridcell">someone</td>
<td role="gridcell">asd</td>
</tr>
<tr role="row">
<td role="gridcell">Mar 20</td>
<td role="gridcell">someone</td>
<td role="gridcell">asdasdsadasdsa</td>
</tr>
<tr role="row">
<td role="gridcell">Mar 14</td>
<td role="gridcell">someone</td>
<td role="gridcell">asdasdsadsadsadsa</td>
</tr>
<tr role="row">
<td role="gridcell">Mar 7</td>
<td role="gridcell">lala</td>
<td role="gridcell">asdasdsadsa</td>
</tr>
</tbody>
</table>
</div>
</div>
I need help scaling down the overall size of the table to fit all screen sizes, most sizes I've covered but can't scale down for mobile screen sizes 600 or less. I mostly use flex box in the media query but can't get the size down less that 600. i'm missing something but can't put my finger on it.
See my code and please advise what i'm missing. any help i'm grateful for.
I'll kick myself i'm sure..
.table {
border-collapse: collapse;
border-spacing: 0;
margin: 0px auto;
display: flex;
flex-direction: column;
flex-wrap: wrap;
justify-content: center;
align-items: center;
}
.table td {
font-family: Arial, sans-serif;
font-size: 14px;
padding: 10px 5px;
border-style: solid;
border-width: 1px;
overflow: hidden;
word-break: normal;
border-color: black;
}
.table th {
font-family: Arial, sans-serif;
font-size: 14px;
font-weight: normal;
padding: 10px 5px;
border-style: solid;
border-width: 1px;
overflow: hidden;
word-break: normal;
border-color: black;
}
.table .index-table {
border-color: inherit;
text-align: center;
vertical-align: middle
}
#media screen and (max-width: 767px) and (max-width: 1025px)and (max-width: 300px) {
.table {
overflow-x: auto;
}
.index-table {
width: auto !important;
}
}
<table class="table">
<tr>
<th class="index-table" colspan="15">Seattle</th>
</tr>
<tr>
<td class="index-table" colspan="15">Hinged Shutter Specification</td>
</tr>
<tr>
<td class="index-table" colspan="3" rowspan="3">Louver Size</td>
<td class="index-table" colspan="8">Width</td>
<td class="index-table" colspan="4" rowspan="2">Height</td>
</tr>
<tr>
<td class="index-table" colspan="2" rowspan="2">Min</td>
<td class="index-table" colspan="6">Max</td>
</tr>
<tr>
<td class="index-table" colspan="2">Single Hung</td>
<td class="index-table" colspan="2">Bi-Fold</td>
<td class="index-table" colspan="2">Multi-Fold</td>
<td class="index-table" colspan="2">Min.</td>
<td class="index-table" colspan="2">Max*</td>
</tr>
<tr>
<td class="index-table" colspan="3" rowspan="2">47mm</td>
<td class="index-table" colspan="2" rowspan="10">152mm</td>
<td class="index-table" colspan="2" rowspan="2">600mm</td>
<td class="index-table" colspan="2" rowspan="10">600mm</td>
<td class="index-table" colspan="2" rowspan="10">N/A</td>
<td class="index-table" colspan="2" rowspan="10">250mm</td>
<td class="index-table" colspan="2" rowspan="10">300mm</td>
</tr>
<tr>
</tr>
<tr>
<td class="index-table" colspan="3" rowspan="2">63mm</td>
<td class="index-table" colspan="2" rowspan="8">750mm</td>
</tr>
<tr>
</tr>
<tr>
<td class="index-table" colspan="3" rowspan="2">76mm</td>
</tr>
<tr>
</tr>
<tr>
<td class="index-table" colspan="3" rowspan="2">89mm</td>
</tr>
<tr>
</tr>
<tr>
<td class="index-table" colspan="3" rowspan="2">114mm</td>
</tr>
<tr>
</tr>
</table>
All you need to do is making your website/page mobile friendly. To do that you have to setup the viewport, You can do so by adding:
<meta name="viewport" content="width=device-width, initial-scale=1.0">
in the head tag in your html file and your good to go. Read more about it here.
I'm trying to automatically expand the rotated columns automatically when there is more text.
I have tried a variety of css such as removing the tranform-origin or using translateX(-50%) translateY(-50%) rotate(-90deg); options.
I wondered if I am missing anything?
Sample of code below is what I'm working on.
.tcentre {
text-align: center;
}
/*Events Matrix*/
.matrix table,
.matrix td,
.matrix th {
border-spacing: 0;
border: 1px solid;
text-align: left
}
.matrix .vert>th:nth-child(1n+3) {
position: relative;
height: 150px;
min-width: 40px;
padding: 4px;
}
.matrix .vert>th {
overflow: hidden;
}
.matrix .vert>th>div>div {
height: 100%;
line-height: 18px;
width: 150px;
position: absolute;
bottom: -145px;
/*border: 1px solid blue; */
transform: rotate(-90deg);
transform-origin: top left;
}
.matrix .tbottom {
vertical-align: bottom !important;
text-align: left !important;
}
<DIV id="content" class="matrix">
<table>
<thead>
<tr class="vert">
<th class="tbottom" style="Width: 100px;">Part</th>
<th class="tbottom" style="Width: 100px;">Name</th>
<th style="Width: 20px;">
<div>
<div>Park<br>2018-08-12</div>
</div>
</th>
<th style="Width: 20px;">
<div>
<div>War Memorial Lots more text in this cell<br>2018-08-19</div>
</div>
</th>
<th style="Width: 20px;">
<div>
<div>Charity Collection<br>2018-10-13</div>
</div>
</th>
<th style="Width: 20px;">
<div>
<div>Concert<br>2018-10-28</div>
</div>
</th>
<th style="Width: 20px;">
<div>
<div>Remembrance<br>2018-11-10</div>
</div>
</th>
</tr>
<tr>
<td class="nowrap">Score</td>
<td class="nowrap">Person 1</td>
<td class="tcentre colour-Y">Y</td>
<td class="tcentre colour-Y">Y</td>
<td class="tcentre colour-Y">Y</td>
<td class="tcentre colour-Y">Y</td>
<td class="tcentre colour-Y">Y</td>
</tr>
<tr>
<td class="nowrap">Solo Cornet</td>
<td class="nowrap">Person 2</td>
<td class="tcentre colour-Y">Y</td>
<td class="tcentre colour-" />
<td class="tcentre colour-" />
<td class="tcentre colour-" />
<td class="tcentre colour-" />
</tr>
</thead>
</table>
</Div>
I'd like to add a border around TD-elements upon hovering.
td:hover{border: 4px solid #dddddd;}
This adds a border but resizes the cell.
How can I prevent the resizing?
I tried adding extra padding and deduct the padding upon hovering, but that did not give the desired result.
table {
font-family: arial, sans-serif;
border-collapse: collapse;
width: 400px;
}
td, th {
border: 1px solid #dddddd;
text-align: left;
padding: 8px;
}
td:hover{
border: 4px solid #dddddd;
}
<body>
<table>
<tr>
<th>Company</th>
<th>Contact</th>
<th>Country</th>
</tr>
<tr>
<td>Alfreds Futterkiste</td>
<td>Maria Anders</td>
<td>Germany</td>
</tr>
<tr>
<td>Centro comercial Moctezuma</td>
<td>Francisco Chang</td>
<td>Mexico</td>
</tr>
<tr>
<td>Ernst Handel</td>
<td>Roland Mendel</td>
<td>Austria</td>
</tr>
<tr>
<td>Island Trading</td>
<td>Helen Bennett</td>
<td>UK</td>
</tr>
<tr>
<td>Laughing Bacchus Winecellars</td>
<td>Yoshi Tannamuri</td>
<td>Canada</td>
</tr>
<tr>
<td>Magazzini Alimentari Riuniti</td>
<td>Giovanni Rovelli</td>
<td>Italy</td>
</tr>
</table>
Use an outline instead of a border.
table {
font-family: arial, sans-serif;
border-collapse: collapse;
width: 400px;
}
td, th {
border: 1px solid #dddddd;
text-align: left;
padding: 8px;
}
td:hover{
outline: 4px solid #dddddd;
}
<body>
<table>
<tr>
<th>Company</th>
<th>Contact</th>
<th>Country</th>
</tr>
<tr>
<td>Alfreds Futterkiste</td>
<td>Maria Anders</td>
<td>Germany</td>
</tr>
<tr>
<td>Centro comercial Moctezuma</td>
<td>Francisco Chang</td>
<td>Mexico</td>
</tr>
<tr>
<td>Ernst Handel</td>
<td>Roland Mendel</td>
<td>Austria</td>
</tr>
<tr>
<td>Island Trading</td>
<td>Helen Bennett</td>
<td>UK</td>
</tr>
<tr>
<td>Laughing Bacchus Winecellars</td>
<td>Yoshi Tannamuri</td>
<td>Canada</td>
</tr>
<tr>
<td>Magazzini Alimentari Riuniti</td>
<td>Giovanni Rovelli</td>
<td>Italy</td>
</tr>
</table>
I think this will solve your issue -
I have used position attribute of CSS for this result. Not used outline attribute because it will overflow your td.
I have added this additional code to your snippet.
td {
position: relative;
}
td:after {
content: '';
position: absolute;
left: 0;
right: 0;
top: 0;
bottom: 0;
}
td:hover:after {
border: 4px solid #dddddd;
}
table {
font-family: arial, sans-serif;
border-collapse: collapse;
width: 400px;
}
td,
th {
border: 1px solid #dddddd;
text-align: left;
padding: 8px;
}
td {
position: relative;
}
td:after {
content: '';
position: absolute;
left: 0;
right: 0;
top: 0;
bottom: 0;
}
td:hover:after {
border: 4px solid #dddddd;
}
<body>
<table>
<tr>
<th>Company</th>
<th>Contact</th>
<th>Country</th>
</tr>
<tr>
<td>Alfreds Futterkiste</td>
<td>Maria Anders</td>
<td>Germany</td>
</tr>
<tr>
<td>Centro comercial Moctezuma</td>
<td>Francisco Chang</td>
<td>Mexico</td>
</tr>
<tr>
<td>Ernst Handel</td>
<td>Roland Mendel</td>
<td>Austria</td>
</tr>
<tr>
<td>Island Trading</td>
<td>Helen Bennett</td>
<td>UK</td>
</tr>
<tr>
<td>Laughing Bacchus Winecellars</td>
<td>Yoshi Tannamuri</td>
<td>Canada</td>
</tr>
<tr>
<td>Magazzini Alimentari Riuniti</td>
<td>Giovanni Rovelli</td>
<td>Italy</td>
</tr>
</table>
I'm trying to add some custom formatting to an e-commerce receipt for printing, with a fixed header and footer to appear on every page printed. The problem is, it seems to intermittently work. Sometimes it loads fine, others, the header appears near the middle of the page rather than at the top. Sometimes just canceling the print dialog box and reopening it has changed how it loads.
Examples:
Correct:
Incorrect:
Incorrect:
Is this some kind of chrome rendering issue?
Full code below:
body{
background: #FFFFFF;
font-size: 12pt;
}
.bold {
font-weight:bold;
}
.clr {
clear: both;
}
.invoice-title {
font-size: 14pt;
color:#734B3A;
margin:25px 0 15px 0;
font-family: Arial, Helvetica, sans-serif;
text-transform: uppercase;
}
table {
width: 100%;
}
th {
text-align: left;
border-bottom:1px solid #EEE;
}
.variation {
font-size: 11px;
}
#main_container {
width:100%;
margin:0 0 30px 0;
}
#main {
width:720px;
margin:auto;
}
#main .header_logo {
text-align: right;
margin:15px 0 15px 0;
font-size: 24px;
font-weight: bold;
color:#000000;
font-family: Arial, Helvetica, sans-serif;
}
#main .wrapper {
border:1px solid #EFECDC;
background-color:#FFFFFF;
}
#main .wrapper-table {
margin:0 0 0 0;
padding:25px 25px 25px 25px;
font-family:Arial, Helvetica, sans-serif;
}
.short_cell {
width: 90px;
}
#media all {
.page-break { display:none; }
}
#media print {
.page-break { display:block; page-break-before:always; }
.noprint { display: none; }
}
body{
margin-top: 145px;
}
#main .header_logo{
font-family: 'Sacramento', cursive;
color: #D79E32;
font-size: 3.5em;
font-weight: normal;
margin-bottom: 20px;
margin-top: 0px;
padding-top: 90px;
line-height: 0.6em;
padding-bottom: 10px;
border-bottom: #ade6df solid 10px;
position: fixed;
top: 0;
width: 715px;
background-color: #fff
}
#main .header_logo img{
max-height: 120px;
max-width: 120px;
float: left;
margin-top: -85px;
}
#main .wrapper{
border:none;
}
.footer {
background: #ade6df;
color: #fff;
text-align: center;
font-family: 'Open Sans', sans-serif;
padding: 5px 0;
font-weight: 300;
position: fixed;
bottom: 0;
width: 715px;
}
.footer a{
color: #fff;
text-decoration: none;
}
.footer .spacer {
font-size: 0.5em;
padding: 0 10px;
vertical-align: middle;
position: relative;
top: -2px;
}
.page-break{
height: 215px;
width: 100%;
}
.page-break:last-child{
display: none;
}
#media screen {
.footer {
bottom: 20px;
}
body{
margin-bottom: 30px;
}
}
<div style="main_container">
<div id="main">
<div class="header_logo">
<img src="/receipt_logo.jpg" alt="" />
My Company
</div>
<div class="clr"></div>
<div class="wrapper">
<div class="wrapper-table">
<table cellpadding="0" cellspacing="5" border="0" style="margin-left:5px;">
<tr>
<td class="invoice-title">Receipt</td>
</tr>
<tr>
<td> </td>
</tr>
<tr>
<td><strong>Date:</strong> 9/13/2016</td>
</tr>
<tr>
<td><strong>Order Number:</strong> 123456789</td>
</tr>
<tr><td><strong>Email:</strong> email#email.com</td></tr><tr><td><strong>Phone:</strong> 585-123-4567</td></tr><tr><td><strong>newsletter subscribe:</strong> 0</td></tr> <tr>
<td>
<table cellpadding="0" cellspacing="0" border="0"><tr>
<td valign="top" style="padding-right: 20px;"><strong>Invoice Address:</strong><br />
Jane J. Doe<br />123 Main Street<br />ANYTOWN, CA 12345<br />US<br /> </td>
<td valign="top"><strong>Shipping Address (Me):</strong><br />Jane J. Doe<br />123 Main Street<br />ANYTOWN, CA 12345<br />US<br />Method: Standard Shipping<br />Shipping: $6.99<br /> </td> </tr></table>
</td>
</tr>
</table>
<table cellpadding="5" cellspacing="5" border="0" style="margin-top:30px;">
<tr>
<th>Product</td>
<th class="short_cell">Price</td>
<th class="short_cell">Qty</td>
<th class="short_cell">Subtotal</td>
</tr>
<tr>
<td><div>Product goes here</div><div class="variation">Ship To: Me</div></td>
<td class="short_cell">$24.99</td>
<td class="short_cell">1</td>
<td class="short_cell">$24.99</td>
</tr>
<tr>
<td><div>Product goes here</div><div class="variation">Ship To: Me</div></td>
<td class="short_cell">$7.99</td>
<td class="short_cell">1</td>
<td class="short_cell">$7.99</td>
</tr>
<tr>
<td><div>Product goes here</div><div class="variation">Ship To: Me</div></td>
<td class="short_cell">$25.00</td>
<td class="short_cell">1</td>
<td class="short_cell">$25.00</td>
</tr>
<tr>
<td><div>Product goes here</div><div class="variation">Ship To: Me</div></td>
<td class="short_cell">$24.99</td>
<td class="short_cell">1</td>
<td class="short_cell">$24.99</td>
</tr>
<tr>
<td><div>Product goes here</div><div class="variation">Ship To: Me</div></td>
<td class="short_cell">$7.99</td>
<td class="short_cell">1</td>
<td class="short_cell">$7.99</td>
</tr>
<tr>
<td><div>Product goes here</div><div class="variation">Ship To: Me</div></td>
<td class="short_cell">$25.00</td>
<td class="short_cell">1</td>
<td class="short_cell">$25.00</td>
</tr>
<tr>
<td><div>Product goes here</div><div class="variation">Ship To: Me</div></td>
<td class="short_cell">$24.99</td>
<td class="short_cell">1</td>
<td class="short_cell">$24.99</td>
</tr>
<tr>
<td><div>Product goes here</div><div class="variation">Ship To: Me</div></td>
<td class="short_cell">$7.99</td>
<td class="short_cell">1</td>
<td class="short_cell">$7.99</td>
</tr>
<tr class="page-break"></tr>
<tr>
<td><div>Product goes here</div><div class="variation">Ship To: Me</div></td>
<td class="short_cell">$25.00</td>
<td class="short_cell">1</td>
<td class="short_cell">$25.00</td>
</tr>
<tr>
<td><div>Product goes here</div><div class="variation">Ship To: Me</div></td>
<td class="short_cell">$24.99</td>
<td class="short_cell">1</td>
<td class="short_cell">$24.99</td>
</tr>
<tr>
<td><div>Product goes here</div><div class="variation">Ship To: Me</div></td>
<td class="short_cell">$7.99</td>
<td class="short_cell">1</td>
<td class="short_cell">$7.99</td>
</tr>
<tr>
<td><div>Product goes here</div><div class="variation">Ship To: Me</div></td>
<td class="short_cell">$25.00</td>
<td class="short_cell">1</td>
<td class="short_cell">$25.00</td>
</tr>
<tr>
<td><div>Product goes here</div><div class="variation">Ship To: Me</div></td>
<td class="short_cell">$24.99</td>
<td class="short_cell">1</td>
<td class="short_cell">$24.99</td>
</tr>
<tr>
<td><div>Product goes here</div><div class="variation">Ship To: Me</div></td>
<td class="short_cell">$7.99</td>
<td class="short_cell">1</td>
<td class="short_cell">$7.99</td>
</tr>
<tr>
<td><div>Product goes here</div><div class="variation">Ship To: Me</div></td>
<td class="short_cell">$25.00</td>
<td class="short_cell">1</td>
<td class="short_cell">$25.00</td>
</tr>
<tr style="margin-top:30px;">
<td> </td>
<td colspan="2" align="right">Shipping:</td>
<td class="short_cell bold">$6.99</td>
</tr>
<tr>
<td> </td>
<td colspan="2" align="right">LAWN:</td>
<td class="short_cell bold">-$8.70</td>
</tr>
<tr>
<td> </td>
<td colspan="2" align="right">Total:</td>
<td class="short_cell bold">$56.27</td>
</tr>
</table>
</div>
</div>
<div class="footer">
My company<span class="spacer">●</span>mycompany.com<span class="spacer">●</span>888-111-1234<span class="spacer">●</span>info#mycompany.com
</div>
</div>
</div>
<div class="page-break"></div>
There is .footer { position: fixed; } directive. I made it a HTML file with your CSS. I checked with Safari print, now that info is coming. But you need adjustment of padding, margin etc. Also footer div class is does not sound good near navigation. Also add that color on print CSS part, else it will be on white background. Here is the raw gist with what probably you wanted -- https://gist.githubusercontent.com/AbhishekGhosh/ddb08179d238ec36f48ee467e4916d42/raw/16e761809f357ba0d2ac085bc6746487451db3d4/stack0410.html . Save it as HTML file and open on your browser.
Note : Edited.
<!DOCTYPE html>
<html>
<head>
<title>This is a title</title>
<style>body{
background: #FFFFFF;
font-size: 12pt;
}
.bold {
font-weight:bold;
}
.clr {
clear: both;
}
.invoice-title {
font-size: 14pt;
color:#734B3A;
margin:25px 0 15px 0;
font-family: Arial, Helvetica, sans-serif;
text-transform: uppercase;
}
table {
width: 100%;
}
th {
text-align: left;
border-bottom:1px solid #EEE;
}
.variation {
font-size: 11px;
}
#main_container {
width:100%;
margin:0 0 30px 0;
}
#main {
width:720px;
margin:auto;
}
#main .header_logo {
text-align: right;
margin:15px 0 15px 0;
font-size: 24px;
font-weight: bold;
color:#000000;
font-family: Arial, Helvetica, sans-serif;
}
#main .wrapper {
border:1px solid #EFECDC;
background-color:#FFFFFF;
}
#main .wrapper-table {
margin:0 0 0 0;
padding:25px 25px 25px 25px;
font-family:Arial, Helvetica, sans-serif;
}
.short_cell {
width: 90px;
}
#media all {
.page-break { display:none; }
}
#media print {
.page-break { display:block; page-break-before:always; }
.noprint { display: none; }
}
body{
margin-top: 145px;
}
#main .header_logo{
font-family: 'Sacramento', cursive;
color: #D79E32;
font-size: 3.5em;
font-weight: normal;
margin-bottom: 20px;
margin-top: 0px;
padding-top: 90px;
line-height: 0.6em;
padding-bottom: 10px;
border-bottom: #ade6df solid 10px;
position: fixed;
top: 0;
width: 715px;
background-color: #fff
}
#main .header_logo img{
max-height: 120px;
max-width: 120px;
float: left;
margin-top: -85px;
}
#main .wrapper{
border:none;
}
.footer {
background: #ade6df;
color: #fff;
text-align: center;
font-family: 'Open Sans', sans-serif;
padding: 5px 0;
font-weight: 300;
#position: fixed;
bottom: 0;
width: 715px;
}
.footer a{
color: #fff;
text-decoration: none;
}
.footer .spacer {
font-size: 0.5em;
padding: 0 10px;
vertical-align: middle;
position: relative;
top: -2px;
}
.page-break{
height: 215px;
width: 100%;
}
.page-break:last-child{
display: none;
}
#media screen {
.footer {
bottom: 20px;
}
body{
margin-bottom: 30px;
}
}</style>
</head>
<body>
<div style="main_container">
<div id="main">
<div class="header_logo">
<img src="/receipt_logo.jpg" alt="" />
My Company
</div>
<div class="clr"></div>
<div class="wrapper">
<div class="wrapper-table">
<table cellpadding="0" cellspacing="5" border="0" style="margin-left:5px;">
<tr>
<td class="invoice-title">Receipt</td>
</tr>
<tr>
<td> </td>
</tr>
<tr>
<td><strong>Date:</strong> 9/13/2016</td>
</tr>
<tr>
<td><strong>Order Number:</strong> 123456789</td>
</tr>
<tr><td><strong>Email:</strong> email#email.com</td></tr><tr><td><strong>Phone:</strong> 585-123-4567</td></tr><tr><td><strong>newsletter subscribe:</strong> 0</td></tr> <tr>
<td>
<table cellpadding="0" cellspacing="0" border="0"><tr>
<td valign="top" style="padding-right: 20px;"><strong>Invoice Address:</strong><br />
Jane J. Doe<br />123 Main Street<br />ANYTOWN, CA 12345<br />US<br /> </td>
<td valign="top"><strong>Shipping Address (Me):</strong><br />Jane J. Doe<br />123 Main Street<br />ANYTOWN, CA 12345<br />US<br />Method: Standard Shipping<br />Shipping: $6.99<br /> </td> </tr></table>
</td>
</tr>
</table>
<table cellpadding="5" cellspacing="5" border="0" style="margin-top:30px;">
<tr>
<th>Product</td>
<th class="short_cell">Price</td>
<th class="short_cell">Qty</td>
<th class="short_cell">Subtotal</td>
</tr>
<tr>
<td><div>Product goes here</div><div class="variation">Ship To: Me</div></td>
<td class="short_cell">$24.99</td>
<td class="short_cell">1</td>
<td class="short_cell">$24.99</td>
</tr>
<tr>
<td><div>Product goes here</div><div class="variation">Ship To: Me</div></td>
<td class="short_cell">$7.99</td>
<td class="short_cell">1</td>
<td class="short_cell">$7.99</td>
</tr>
<tr>
<td><div>Product goes here</div><div class="variation">Ship To: Me</div></td>
<td class="short_cell">$25.00</td>
<td class="short_cell">1</td>
<td class="short_cell">$25.00</td>
</tr>
<tr>
<td><div>Product goes here</div><div class="variation">Ship To: Me</div></td>
<td class="short_cell">$24.99</td>
<td class="short_cell">1</td>
<td class="short_cell">$24.99</td>
</tr>
<tr>
<td><div>Product goes here</div><div class="variation">Ship To: Me</div></td>
<td class="short_cell">$7.99</td>
<td class="short_cell">1</td>
<td class="short_cell">$7.99</td>
</tr>
<tr>
<td><div>Product goes here</div><div class="variation">Ship To: Me</div></td>
<td class="short_cell">$25.00</td>
<td class="short_cell">1</td>
<td class="short_cell">$25.00</td>
</tr>
<tr>
<td><div>Product goes here</div><div class="variation">Ship To: Me</div></td>
<td class="short_cell">$24.99</td>
<td class="short_cell">1</td>
<td class="short_cell">$24.99</td>
</tr>
<tr>
<td><div>Product goes here</div><div class="variation">Ship To: Me</div></td>
<td class="short_cell">$7.99</td>
<td class="short_cell">1</td>
<td class="short_cell">$7.99</td>
</tr>
<tr class="page-break"></tr>
<tr>
<td><div>Product goes here</div><div class="variation">Ship To: Me</div></td>
<td class="short_cell">$25.00</td>
<td class="short_cell">1</td>
<td class="short_cell">$25.00</td>
</tr>
<tr>
<td><div>Product goes here</div><div class="variation">Ship To: Me</div></td>
<td class="short_cell">$24.99</td>
<td class="short_cell">1</td>
<td class="short_cell">$24.99</td>
</tr>
<tr>
<td><div>Product goes here</div><div class="variation">Ship To: Me</div></td>
<td class="short_cell">$7.99</td>
<td class="short_cell">1</td>
<td class="short_cell">$7.99</td>
</tr>
<tr>
<td><div>Product goes here</div><div class="variation">Ship To: Me</div></td>
<td class="short_cell">$25.00</td>
<td class="short_cell">1</td>
<td class="short_cell">$25.00</td>
</tr>
<tr>
<td><div>Product goes here</div><div class="variation">Ship To: Me</div></td>
<td class="short_cell">$24.99</td>
<td class="short_cell">1</td>
<td class="short_cell">$24.99</td>
</tr>
<tr>
<td><div>Product goes here</div><div class="variation">Ship To: Me</div></td>
<td class="short_cell">$7.99</td>
<td class="short_cell">1</td>
<td class="short_cell">$7.99</td>
</tr>
<tr>
<td><div>Product goes here</div><div class="variation">Ship To: Me</div></td>
<td class="short_cell">$25.00</td>
<td class="short_cell">1</td>
<td class="short_cell">$25.00</td>
</tr>
<tr style="margin-top:30px;">
<td> </td>
<td colspan="2" align="right">Shipping:</td>
<td class="short_cell bold">$6.99</td>
</tr>
<tr>
<td> </td>
<td colspan="2" align="right">LAWN:</td>
<td class="short_cell bold">-$8.70</td>
</tr>
<tr>
<td> </td>
<td colspan="2" align="right">Total:</td>
<td class="short_cell bold">$56.27</td>
</tr>
</table>
</div>
</div>
<div class="footer">
My company<span class="spacer">●</span>mycompany.com<span class="spacer">●</span>888-111-1234<span class="spacer">●</span>info#mycompany.com
</div>
</div>
</div>
<div class="page-break"></div>
</body>
</html>