Display checkbox instead of image inside table table cell - html

I want to align check box with image (barcode) on the left side of that column. What I've tried so far is insert same image in both columns, but hide the one on the right. Instead of image on the right, checkbox is shown. But, it is not aligned with barcode on the left column. Is it possible to do this?
Image size can vary, it is dynamic. That is why I've inserted same image on both columns (same height). On the example all barcode images are of the same size, but it's not necessary the case.
Perhaps someone has better idea to align checkboxes on the right with barcodes on the left?
Here is the example.
The code I have problem with (I want to align this checkbox):
<img src='http://i.imgur.com/4PxPOjx.png' style='visibility:hidden;width:30px;'>
<input type='checkbox'><br/>
<label></label><br/>
Currently it looks like this:

rowspan attribute can be used for your td!
Since, you didnt want to have the rows specifically visible, style the td that contains the barcode with border-bottom-style 0px.
With that, you task would be simplified!
#tblArticles{font-size: 12px !important; font-family: verdana, sans-serif; border-collapse: collapse; width: 100%;}
#tblArticles td{border: 1px solid black;text-align: center;padding: 8px;}
#tblArticles th {border: 1px solid black;text-align: center;padding: 8px;background-color: #dddddd;}
/*#tblArticles tr:nth-child(even) {background-color: #dddddd;}*/</style>
<style>#tblLeft{position:absolute;left:0; font-size: 10px !important; font-family: verdana, sans-serif;border-collapse:collapse; width:40%;}
#tblLeft td{font-size: 10px !important; border: 1px solid black;text-align: center;padding: 8px;}
#tblLeft th {font-size: 10px !important; border: 1px solid black;text-align: center;padding: 8px;background-color: #dddddd;}</style>
<style>#tblRight{position:absolute;right:0; font-size: 10px !important; font-family: verdana, sans-serif;border-collapse:collapse; width:20%;}
#tblRight td{font-size: 10px !important; text-align: center;padding: 8px;}
<label style='margin-right:20px;'><b>Opomba za dostavo:</b></label>545454<br/>
<label style='margin-right:20px;'><b>Št. zunanje naročilnice:</b></label>fsdfsfd<br/><br/>
<table border="1" id='tblArticles'>
<thead>
<th>Vrsta blaga/storitve</th>
<th>Interna številka</th>
<th>Prodana koda</th>
<th>Količina</th>
<th>EnM</th>
<th>Cena brez DDV</th>
<th>Vrednost brez DDV</th>
<th>DDV</th>
<th>Znesek DDV</th>
<th>Vrednost z DDV</th>
</thead>
<tfoot>
<tr style='visibility:hidden;'><td></td></tr>
<tr style='visibility:hidden;'><td></td></tr>
<tr style='visibility:hidden;'><td></td></tr>
</tfoot>
<tbody>
<tr>
<td rowspan="11"><label>Mali kuharski mojster</label></td>
<td style="border-bottom-style:hidden;">
<img src='http://i.imgur.com/4PxPOjx.png'><br><label>NUdVOVFWIE1L</label><br/>
</td>
<td><input type='checkbox'><br/>
<label></label><br/></td>
<td rowspan="11">11,00</td>
<td rowspan="11">KOM</td>
<td rowspan="11">3221,00 €</td>
<td rowspan="11">35431,00 €</td>
<td rowspan="11">22,00 %</td>
<td rowspan="11">7794,82 €</td>
<td rowspan="11">43225,82 €</td>
</tr>
<tr>
<td style="border-bottom-style:0px;">
<img src='http://i.imgur.com/4PxPOjx.png'><br><label>NUdVOVFWIE1L</label><br/>
</td>
<td><input type='checkbox'><br/>
</td>
</tr>
</tbody>
</table><br/>
<div style='page-break-inside:avoid;margin-bottom: 30px;'>
<label style='position:relative;left:0;font-size:12px;'>Specifikacija obračunanega davka, dokumenta št.:</label><br/>
<div id='divBottom' style='position:relative;width:100%;min-height:160px;'>
<table id='tblLeft'>
<th>Stopnja</th><th>Osnova za DDV</th><th>Znesek DDV</th><th>Vrednost z DDV</th>
<tr>
<td>9,5 %</td><td>0,00 €</td><td>0,00 €</td><td>0,00 €</td>
</tr><tr>
<td>22 %</td><td>37929,10 €</td><td>8344,40 €</td><td>46273,50 €</td>
</tr>
</table>
<table id='tblRight'>
<tr style='border-bottom:1px solid black !important;'>
<td style='text-align:left;'><b>Skupaj brez DDV:</b></td><td style='text-align:right;'>37929,10 €</td>
</tr>
<tr>
<td style='text-align:left;'><b>Osnova za DDV</b></td><td style='text-align:right;'>37929,10 €</td>
</tr>
<tr style='border-bottom:1px solid black !important;'>
<td style='text-align:left;'><b>DDV:</b></td><td style='text-align:right;'>8344,40 €</td>
</tr>
</table>
<label style='position:absolute;right:80px;bottom:20px;'><b>SKUPAJ:</b></label>
<label style='position:absolute;right:0;bottom:20px;'><b>46273,50 €</b></label>
</div></div><br/><br/><br/>
Hope it helps!

Here you go, working fiddle:
* {
text-align: center;
}
<table style="width:100%">
<tr>
<th>x</th>
<th>y</th>
</tr>
<tr>
<td><img src="http://media.idownloadblog.com/wp-content/uploads/2016/09/Google-Allo-1.0-for-iOS-app-icon-small.png"></td>
<td>
<input type="radio" name="xy" value="xy">
</td>
</tr>
<tr>
<td><img src="https://lh3.googleusercontent.com/S8DKhY39f1jpVy1-JV3qpI_ftuJwJnKjNbRhrVRGi-MQjr6i73JQI3-dmkQ93E0Jb4hT=w300"></td>
<td>
<input type="radio" name="xy" value="xy">
</td>
</tr>
</table>

As per my understanding you may use this code, first run this code by clicking on Run code Snippet button and then verify what was your expectation :
<html>
<body>
<table>
<tr>
<th>
Left Column
</th>
<th>
Right Column
</th>
</tr>
<tr>
<td>
<img src="https://dummyimage.com/240x80/000/fff">
</td>
<td>
<input type="checkbox" style="display:block; margin:0 auto;">
</td>
</tr>
</table>
</body>
</html>

Just make your table properly, rearrange checkboxes and images to they suit the following structure:
<table style="width:100%">
<tr>
<th>Image</th>
<th>Checkbox</th>
</tr>
<tr>
<td><img src="http://placehold.it/200x50" alt="Image"></td>
<td><input type="checkbox"></td>
</tr>
<tr>
<td><img src="http://placehold.it/200x100" alt="Image"></td>
<td><input type="checkbox"></td>
</tr>
<tr>
<td><img src="http://placehold.it/200x30" alt="Image"></td>
<td><input type="checkbox"></td>
</tr>
</table>
If you face the problem of "merging" cells (as it's done in your first column), take a look on this example:
table, th, td {
border: 1px solid black;
border-collapse: collapse;
}
td {
text-align: center;
}
img {
vertical-align: top;
}
img ~ label {
display: block;
}
<table style="width:100%">
<thead>
<th>Vrsta blaga/storitve</th>
<th>Interna številka</th>
<th>Prodana koda</th>
</thead>
<tr>
<td rowspan="3">Mali kuharski mojster</td>
<td><img src="http://placehold.it/200x50" alt="Image"><label>NllMUkZGIE1L</label></td>
<td><input type="checkbox"></td>
</tr>
<tr>
<td><img src="http://placehold.it/200x100" alt="Image"><label>SDRNM0Q4IE1L</label></td>
<td><input type="checkbox"></td>
</tr>
<tr>
<td><img src="http://placehold.it/200x30" alt="Image"><label>RzNCRTJYIE1L</label></td>
<td><input type="checkbox"></td>
</tr>
</table>
Pay attention to "rowspan" attribute!

Related

scrollbar in IE is working but not in chrome

i have a table like below where the scrollbar is working in IE 11 with scroll=yes, but the same is not working in Chrome.Any suggestion or help would be appreciated . thank you.
table,
td {
border: 1px solid black;
border-collapse: collapse;
padding: 5px;
text-align: left;
}
<body scroll="yes" scrolling="yes">
<table style="width:100%">
<tr>
<td width="25%"><label>name </label></td>
<td width="75%"><input type="text"></td>
</tr>
<tr>
<td width="25%"><label>last name </label></td>
<td width="75%"><input type="text"></td>
</tr>
<tr>
<td width="25%"><label>middle name </label></td>
<td width="75%"><input type="text"></td>
</tr>
<tr>
<td width="25%"><label> name </label></td>
<td width="75%"><input type="text"></td>
</tr>
</table>
Neither of those attributes on the body element are supported in anything other than Internet Explorer. In fact, the Mozilla Developer Network website doesn't list it as an attribute: https://developer.mozilla.org/en-US/docs/Web/HTML/Element/body
I would recommend doing it in css instead using overflow, overflow-x or overflow-y
Simply add overflow-y:auto to your body tag and that should work. (or overflow-y:scroll)
table,
td {
border: 1px solid black;
border-collapse: collapse;
padding: 5px;
text-align: left;
}
<body scroll="yes" scrolling="yes" style='overflow-y: auto;'>
<table style="width:100%">
<tr>
<td width="25%"><label>name </label></td>
<td width="75%"><input type="text"></td>
</tr>
<tr>
<td width="25%"><label>last name </label></td>
<td width="75%"><input type="text"></td>
</tr>
<tr>
<td width="25%"><label>middle name </label></td>
<td width="75%"><input type="text"></td>
</tr>
<tr>
<td width="25%"><label> name </label></td>
<td width="75%"><input type="text"></td>
</tr>
</table>

Export HTML to PDF always align at the bottom of a new page

I am having a problem with export html to PDF. I would like section at the bottom to be always aligned at the bottom of a new page.
Right now this section (when it comes to page break) is aligned at the top of a new page:
Code for that section:
<div style='page-break-inside:avoid;vertical-align:bottom;'>
<font face="Verdana" >
<br>
<table cellspacing="0" cellpadding="0" style="width:900px;">
<tbody>
<tr>
<td style="width:500px">
BLAGO DOSTAVIL: ______________________<br/><br/>
Podpis<br/><br/>
Datum: ______________________
</td>
<td>
BLAGO PREVZEL: ______________________<br/><br/>
Podpis<br/><br/>
Datum: ______________________
</td>
</tr>
</tbody>
</table>
</font>
<font face="Verdana" size="1" >
<br /><br />
<table cellspacing="0" cellpadding="0" style="width:900px;">
<tbody>
<tr>
<td style="text-align:center">
<i>
testting d.o.o., testing, ID za DDV: testing, matična št.: testing
<br>
tel: +386 XXXXXXXXXX, fax: +386 1 XXXXXXXXX, e-mail: info#XXXX.si, web: www.xxxxxxx.si
<br>
Družba je vpisana pri okrožnem sodišču v Ljubljani, št. vpisa v registru: 1/XXXXX/00, ustanovni kapital: XX.000 EUR
<br>
Račun odprt pri NLB d.d., Iban: SIXXXXXXX, SWIFT-BIC: LJBASI2X
</i>
</td>
</tr>
</tbody>
</table>
</font>
</div>
Here is my code for the whole page (including section at the bottom which jumps into new page at page break):
<style>#tblArticles{font-size: 12px !important; font-family: verdana, sans-serif; border-collapse: collapse; width: 100%;}
#tblArticles td{border: 1px solid black;text-align: center;padding: 8px;}
#tblArticles th {border: 1px solid black;text-align: center;padding: 8px;background-color: #dddddd;}
</style>
<style>#tblLeft{position:absolute;left:0; font-size: 10px !important; font-family: verdana, sans-serif;border-collapse:collapse; width:40%;}
#tblLeft td{font-size: 10px !important; border: 1px solid black;text-align: center;padding: 8px;}
#tblLeft th {font-size: 10px !important; border: 1px solid black;text-align: center;padding: 8px;background-color: #dddddd;}</style>
<style>#tblRight{position:absolute;right:0; font-size: 10px !important; font-family: verdana, sans-serif;border-collapse:collapse; width:20%;}
#tblRight td{font-size: 10px !important; text-align: center;padding: 8px;}</style>
<table id='tblArticles'>
<thead>
<th>Vrsta blaga/storitve</th>
<th>Interna številka</th>
<th>Prodana koda</th>
<th>Količina</th>
<th>EnM</th>
<th>Cena brez DDV</th>
<th>Vrednost brez DDV</th>
<th>DDV</th>
<th>Znesek DDV</th>
<th>Vrednost z DDV</th>
</thead>
<tfoot>
<tr style='visibility:hidden;'><td></td></tr>
<tr style='visibility:hidden;'><td></td></tr>
<tr style='visibility:hidden;'><td></td></tr>
</tfoot>
<tbody style='page-break-inside:avoid;'>
<tr style='page-break-inside:avoid;border-bottom:1px solid black !important;'>
<td rowspan='1' style='page-break-inside:avoid;'><label>Večerja na zajli</label></td>
<td style=''>
<img src=http://localhost:53358/resources/Images/EAN128/VzlSSlNYVlo=.jpg><br/>
<label>VzlSSlNYVlo=</label><br/>
</td>
<td style=''><input type='checkbox'><br/><label></label><br/></td>
<td style='overflow: hidden; white-space: nowrap;' rowspan='1'>1,00</td>
<td style='overflow: hidden; white-space: nowrap;' rowspan='1'>KOM</td>
<td style='overflow: hidden; white-space: nowrap;' rowspan='1'>91,14 €</td>
<td style='overflow: hidden; white-space: nowrap;' rowspan='1'>91,14 €</td>
<td style='overflow: hidden; white-space: nowrap;' rowspan='1'>9,50 %</td>
<td style='overflow: hidden; white-space: nowrap;' rowspan='1'>8,66 €</td>
<td style='overflow: hidden; white-space: nowrap;' rowspan='1'>99,80 €</td>
</tr>
<tr style='page-break-inside:avoid;border-bottom:1px solid black !important;'>
<td rowspan='7' style='page-break-inside:avoid;'><label>Veliki kuharski mojster</label></td>
<td style='border-bottom-style:hidden;'>
<img src=http://localhost:53358/resources/Images/EAN128/TDZKVzRDVks=.jpg><br/>
<label>TDZKVzRDVks=</label><br/>
</td>
<td style='border-bottom-style:hidden;'><input type='checkbox'><br/><label></label><br/></td>
<td style='overflow: hidden; white-space: nowrap;' rowspan='7'>7,00</td>
<td style='overflow: hidden; white-space: nowrap;' rowspan='7'>KOM</td>
<td style='overflow: hidden; white-space: nowrap;' rowspan='7'>65,69 €</td>
<td style='overflow: hidden; white-space: nowrap;' rowspan='7'>459,83 €</td>
<td style='overflow: hidden; white-space: nowrap;' rowspan='7'>22,00 %</td>
<td style='overflow: hidden; white-space: nowrap;' rowspan='7'>101,16 €</td>
<td style='overflow: hidden; white-space: nowrap;' rowspan='7'>560,99 €</td>
</tr>
<tr style='page-break-inside:avoid;border-bottom:1px solid black !important;'>
<td style='border-bottom-style:hidden;'>
<img src=http://localhost:53358/resources/Images/EAN128/Q0U2RURCVks=.jpg><br/>
<label>Q0U2RURCVks=</label><br/>
</td>
<td style='border-bottom-style:hidden;'><input type='checkbox'><br/><label></label><br/></td>
</tr>
<tr style='page-break-inside:avoid;border-bottom:1px solid black !important;'>
<td style='border-bottom-style:hidden;'>
<img src=http://localhost:53358/resources/Images/EAN128/RFg0TVZXVks=.jpg><br/>
<label>RFg0TVZXVks=</label><br/>
</td>
<td style='border-bottom-style:hidden;'><input type='checkbox'><br/><label></label><br/></td>
</tr>
<tr style='page-break-inside:avoid;border-bottom:1px solid black !important;'>
<td style='border-bottom-style:hidden;'>
<img src=http://localhost:53358/resources/Images/EAN128/OFdGRTJLVks=.jpg><br/>
<label>OFdGRTJLVks=</label><br/>
</td>
<td style='border-bottom-style:hidden;'><input type='checkbox'><br/><label></label><br/></td>
</tr>
<tr style='page-break-inside:avoid;border-bottom:1px solid black !important;'>
<td style='border-bottom-style:hidden;'>
<img src=http://localhost:53358/resources/Images/EAN128/QlROR0NMVks=.jpg><br/>
<label>QlROR0NMVks=</label><br/>
</td>
<td style='border-bottom-style:hidden;'><input type='checkbox'><br/><label></label><br/></td>
</tr>
<tr style='page-break-inside:avoid;border-bottom:1px solid black !important;'>
<td style='border-bottom-style:hidden;'>
<img src=http://localhost:53358/resources/Images/EAN128/SjNYWkJOVks=.jpg><br/>
<label>SjNYWkJOVks=</label><br/>
</td>
<td style='border-bottom-style:hidden;'><input type='checkbox'><br/><label></label><br/></td>
</tr>
<tr style='page-break-inside:avoid;border-bottom:1px solid black !important;'>
<td style=''>
<img src=http://localhost:53358/resources/Images/EAN128/M0RFWURXVks=.jpg><br/>
<label>M0RFWURXVks=</label><br/>
</td>
<td style=''><input type='checkbox'><br/><label></label><br/></td>
</tr>
</tbody>
</table><br/>
<div style='page-break-inside:avoid;margin-bottom: 30px;'>
<label style='position:relative;left:0;font-size:12px;'>Specifikacija obračunanega davka, dokumenta št.:</label><br/>
<div id='divBottom' style='position:relative;width:100%;min-height:160px;'>
<table id='tblLeft'>
<th>Stopnja</th><th>Osnova za DDV</th><th>Znesek DDV</th><th>Vrednost z DDV</th>
<tr>
<td>9,5 %</td><td>91,14 €</td><td>8,66 €</td><td>99,80 €</td>
</tr><tr>
<td>22 %</td><td>459,83 €</td><td>101,16 €</td><td>560,99 €</td>
</tr>
</table>
<table id='tblRight'>
<tr style='border-bottom:1px solid black !important;'>
<td style='text-align:left;'><b>Skupaj brez DDV:</b></td><td style='text-align:right;'>550,97 €</td>
</tr>
<tr>
<td style='text-align:left;'><b>Osnova za DDV</b></td><td style='text-align:right;'>550,97 €</td>
</tr>
<tr style='border-bottom:1px solid black !important;'>
<td style='text-align:left;'><b>DDV:</b></td><td style='text-align:right;'>109,82 €</td>
</tr>
</table>
<label style='position:absolute;right:80px;bottom:20px;'><b>SKUPAJ:</b></label>
<label style='position:absolute;right:0;bottom:20px;'><b>660,79 €</b></label>
</div></div><br/><br/><br/>
<div style='page-break-inside:avoid;vertical-align:bottom;'>
<font face="Verdana" >
<br>
<table cellspacing="0" cellpadding="0" style="width:900px;">
<tbody>
<tr>
<td style="width:500px">
BLAGO DOSTAVIL: ______________________<br/><br/>
Podpis<br/><br/>
Datum: ______________________
</td>
<td>
BLAGO PREVZEL: ______________________<br/><br/>
Podpis<br/><br/>
Datum: ______________________
</td>
</tr>
</tbody>
</table>
</font>
<font face="Verdana" size="1" >
<br /><br />
<table cellspacing="0" cellpadding="0" style="width:900px;">
<tbody>
<tr>
<td style="text-align:center">
<i>
testting d.o.o., testing, ID za DDV: testing, matična št.: testing
<br>
tel: +386 XXXXXXXXXX, fax: +386 1 XXXXXXXXX, e-mail: info#XXXX.si, web: www.xxxxxxx.si
<br>
Družba je vpisana pri okrožnem sodišču v Ljubljani, št. vpisa v registru: 1/XXXXX/00, ustanovni kapital: XX.000 EUR
<br>
Račun odprt pri NLB d.d., Iban: SIXXXXXXX, SWIFT-BIC: LJBASI2X
</i>
</td>
</tr>
</tbody>
</table>
</font>
</div>
I just moved the table holding contact info at the bottom of the page as a new:
<tr><td colspan="2"></td></tr>
to the table we are going to stick it to the bottom of the page while printing.
Then you need to only add a style rule for #media print, like this:
#media print{
table#stickToFooter{
position: fixed;
bottom: 0;
}
}
Say, I didn't manipulate you code in other parts, but just as a best-practice rule, please try to avoid surrounding none-inline level elements in inline tags. I mean it'd be much better if you set table's font-family & size using these styling elements:
table{
font-family: Verdana, sans-serif;
font-size: 10px
}
than enclosing it inside a <font face="Verdana" size="1">...</font> tag. Thanks in advance.
<style>#tblArticles{font-size: 12px !important; font-family: verdana, sans-serif; border-collapse: collapse; width: 100%;}
#tblArticles td{border: 1px solid black;text-align: center;padding: 8px;}
#tblArticles th {border: 1px solid black;text-align: center;padding: 8px;background-color: #dddddd;}
</style>
<style>#tblLeft{position:absolute;left:0; font-size: 10px !important; font-family: verdana, sans-serif;border-collapse:collapse; width:40%;}
#tblLeft td{font-size: 10px !important; border: 1px solid black;text-align: center;padding: 8px;}
#tblLeft th {font-size: 10px !important; border: 1px solid black;text-align: center;padding: 8px;background-color: #dddddd;}</style>
<style>#tblRight{position:absolute;right:0; font-size: 10px !important; font-family: verdana, sans-serif;border-collapse:collapse; width:20%;}
#tblRight td{font-size: 10px !important; text-align: center;padding: 8px;}</style>
<style>
#media print{
table#stickToFooter{
position: fixed;
bottom: 0;
}
}
</style>
<table id='tblArticles'>
<thead>
<th>Vrsta blaga/storitve</th>
<th>Interna številka</th>
<th>Prodana koda</th>
<th>Količina</th>
<th>EnM</th>
<th>Cena brez DDV</th>
<th>Vrednost brez DDV</th>
<th>DDV</th>
<th>Znesek DDV</th>
<th>Vrednost z DDV</th>
</thead>
<tfoot>
<tr style='visibility:hidden;'><td></td></tr>
<tr style='visibility:hidden;'><td></td></tr>
<tr style='visibility:hidden;'><td></td></tr>
</tfoot>
<tbody style='page-break-inside:avoid;'>
<tr style='page-break-inside:avoid;border-bottom:1px solid black !important;'>
<td rowspan='1' style='page-break-inside:avoid;'><label>Večerja na zajli</label></td>
<td style=''>
<img src=http://localhost:53358/resources/Images/EAN128/VzlSSlNYVlo=.jpg><br/>
<label>VzlSSlNYVlo=</label><br/>
</td>
<td style=''><input type='checkbox'><br/><label></label><br/></td>
<td style='overflow: hidden; white-space: nowrap;' rowspan='1'>1,00</td>
<td style='overflow: hidden; white-space: nowrap;' rowspan='1'>KOM</td>
<td style='overflow: hidden; white-space: nowrap;' rowspan='1'>91,14 €</td>
<td style='overflow: hidden; white-space: nowrap;' rowspan='1'>91,14 €</td>
<td style='overflow: hidden; white-space: nowrap;' rowspan='1'>9,50 %</td>
<td style='overflow: hidden; white-space: nowrap;' rowspan='1'>8,66 €</td>
<td style='overflow: hidden; white-space: nowrap;' rowspan='1'>99,80 €</td>
</tr>
<tr style='page-break-inside:avoid;border-bottom:1px solid black !important;'>
<td rowspan='7' style='page-break-inside:avoid;'><label>Veliki kuharski mojster</label></td>
<td style='border-bottom-style:hidden;'>
<img src=http://localhost:53358/resources/Images/EAN128/TDZKVzRDVks=.jpg><br/>
<label>TDZKVzRDVks=</label><br/>
</td>
<td style='border-bottom-style:hidden;'><input type='checkbox'><br/><label></label><br/></td>
<td style='overflow: hidden; white-space: nowrap;' rowspan='7'>7,00</td>
<td style='overflow: hidden; white-space: nowrap;' rowspan='7'>KOM</td>
<td style='overflow: hidden; white-space: nowrap;' rowspan='7'>65,69 €</td>
<td style='overflow: hidden; white-space: nowrap;' rowspan='7'>459,83 €</td>
<td style='overflow: hidden; white-space: nowrap;' rowspan='7'>22,00 %</td>
<td style='overflow: hidden; white-space: nowrap;' rowspan='7'>101,16 €</td>
<td style='overflow: hidden; white-space: nowrap;' rowspan='7'>560,99 €</td>
</tr>
<tr style='page-break-inside:avoid;border-bottom:1px solid black !important;'>
<td style='border-bottom-style:hidden;'>
<img src=http://localhost:53358/resources/Images/EAN128/Q0U2RURCVks=.jpg><br/>
<label>Q0U2RURCVks=</label><br/>
</td>
<td style='border-bottom-style:hidden;'><input type='checkbox'><br/><label></label><br/></td>
</tr>
<tr style='page-break-inside:avoid;border-bottom:1px solid black !important;'>
<td style='border-bottom-style:hidden;'>
<img src=http://localhost:53358/resources/Images/EAN128/RFg0TVZXVks=.jpg><br/>
<label>RFg0TVZXVks=</label><br/>
</td>
<td style='border-bottom-style:hidden;'><input type='checkbox'><br/><label></label><br/></td>
</tr>
<tr style='page-break-inside:avoid;border-bottom:1px solid black !important;'>
<td style='border-bottom-style:hidden;'>
<img src=http://localhost:53358/resources/Images/EAN128/OFdGRTJLVks=.jpg><br/>
<label>OFdGRTJLVks=</label><br/>
</td>
<td style='border-bottom-style:hidden;'><input type='checkbox'><br/><label></label><br/></td>
</tr>
<tr style='page-break-inside:avoid;border-bottom:1px solid black !important;'>
<td style='border-bottom-style:hidden;'>
<img src=http://localhost:53358/resources/Images/EAN128/QlROR0NMVks=.jpg><br/>
<label>QlROR0NMVks=</label><br/>
</td>
<td style='border-bottom-style:hidden;'><input type='checkbox'><br/><label></label><br/></td>
</tr>
<tr style='page-break-inside:avoid;border-bottom:1px solid black !important;'>
<td style='border-bottom-style:hidden;'>
<img src=http://localhost:53358/resources/Images/EAN128/SjNYWkJOVks=.jpg><br/>
<label>SjNYWkJOVks=</label><br/>
</td>
<td style='border-bottom-style:hidden;'><input type='checkbox'><br/><label></label><br/></td>
</tr>
<tr style='page-break-inside:avoid;border-bottom:1px solid black !important;'>
<td style=''>
<img src=http://localhost:53358/resources/Images/EAN128/M0RFWURXVks=.jpg><br/>
<label>M0RFWURXVks=</label><br/>
</td>
<td style=''><input type='checkbox'><br/><label></label><br/></td>
</tr>
</tbody>
</table><br/>
<div style='page-break-inside:avoid;margin-bottom: 30px;'>
<label style='position:relative;left:0;font-size:12px;'>Specifikacija obračunanega davka, dokumenta št.:</label><br/>
<div id='divBottom' style='position:relative;width:100%;min-height:160px;'>
<table id='tblLeft'>
<th>Stopnja</th><th>Osnova za DDV</th><th>Znesek DDV</th><th>Vrednost z DDV</th>
<tr>
<td>9,5 %</td><td>91,14 €</td><td>8,66 €</td><td>99,80 €</td>
</tr><tr>
<td>22 %</td><td>459,83 €</td><td>101,16 €</td><td>560,99 €</td>
</tr>
</table>
<table id='tblRight'>
<tr style='border-bottom:1px solid black !important;'>
<td style='text-align:left;'><b>Skupaj brez DDV:</b></td><td style='text-align:right;'>550,97 €</td>
</tr>
<tr>
<td style='text-align:left;'><b>Osnova za DDV</b></td><td style='text-align:right;'>550,97 €</td>
</tr>
<tr style='border-bottom:1px solid black !important;'>
<td style='text-align:left;'><b>DDV:</b></td><td style='text-align:right;'>109,82 €</td>
</tr>
</table>
<label style='position:absolute;right:80px;bottom:20px;'><b>SKUPAJ:</b></label>
<label style='position:absolute;right:0;bottom:20px;'><b>660,79 €</b></label>
</div></div><br/><br/><br/>
<div style='page-break-inside:avoid;vertical-align:bottom;'>
<font face="Verdana" >
<br>
<table cellspacing="0" cellpadding="0" style="width:900px;">
<tbody>
<tr>
<td style="width:500px">
BLAGO DOSTAVIL: ______________________<br/><br/>
Podpis<br/><br/>
Datum: ______________________
</td>
<td>
BLAGO PREVZEL: ______________________<br/><br/>
Podpis<br/><br/>
Datum: ______________________
</td>
</tr>
<tr>
<td colspan="2" style="text-align:center; font-size: 10px;">
<i>
testting d.o.o., testing, ID za DDV: testing, matična št.: testing
<br>
tel: +386 XXXXXXXXXX, fax: +386 1 XXXXXXXXX, e-mail: info#XXXX.si, web: www.xxxxxxx.si
<br>
Družba je vpisana pri okrožnem sodišču v Ljubljani, št. vpisa v registru: 1/XXXXX/00, ustanovni kapital: XX.000 EUR
<br>
Račun odprt pri NLB d.d., Iban: SIXXXXXXX, SWIFT-BIC: LJBASI2X
</i>
</td>
</tr>
</tbody>
</table>
</font>
</div>
I used JS for solving your problem and make minor changes in your code. You can look at it, I marked my changes with <--EDIT--> comment.
I assumed, that your problem occur when either of your 'Type of goods' table or 'DDV' table get too high to fit on one page with your 'signature' section.
My JS script use function to check height of those tables, make calculation, and if combined height is bigger than certain treshold (825px) it manualy break page. After that, it set margin for your 'signature' section to move it at the bottom of new page (margin wary from 1110px for EDGE&FFOX to 1160 for CHROME).
Note, that this changes will take effect only for "print" version (i used separate <.style> for #media print) and are not visible in web wersion.
I hope you will find it usefull.
CODE:
<!DOCTYPE html>
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8">
<!--EDIT-->
<!--you can test different height setups for #tblArticles to see how it behaves /more than 825 will triger page break ;-) -->
<style>
#tblArticles{font-size: 12px !important; font-family: verdana, sans-serif; border-collapse: collapse; width: 100%; }
#tblArticles td{border: 1px solid black;text-align: center;padding: 8px;}
#tblArticles th {border: 1px solid black;text-align: center;padding: 8px;background-color: #dddddd;}
#tblLeft{position:absolute;left:0; font-size: 10px !important; font-family: verdana, sans-serif;border-collapse:collapse; width:40%;}
#tblLeft td{font-size: 10px !important; border: 1px solid black;text-align: center;padding: 8px;}
#tblLeft th {font-size: 10px !important; border: 1px solid black;text-align: center;padding: 8px;background-color: #dddddd;}
#tblRight{position:absolute;right:0; font-size: 10px !important; font-family: verdana, sans-serif;border-collapse:collapse; width:20%;}
#tblRight td{font-size: 10px !important; text-align: center;padding: 8px;}
</style>
<!--container for js function fun() to put new css rule for print if condition is met (see <script> at the bottom)-->
<style id="printStyle"><!--EDIT-->
</style><!--EDIT-->
</head>
<!-- run function fun() after page is loaded and table height is calculated -->
<body onload="fun()"><!--EDIT-->
<table id='tblArticles'>
<thead>
<th>Vrsta blaga/storitve</th>
<th>Interna številka</th>
<th>Prodana koda</th>
<th>Količina</th>
<th>EnM</th>
<th>Cena brez DDV</th>
<th>Vrednost brez DDV</th>
<th>DDV</th>
<th>Znesek DDV</th>
<th>Vrednost z DDV</th>
</thead>
<tfoot>
<tr style='visibility:hidden;'><td></td></tr>
<tr style='visibility:hidden;'><td></td></tr>
<tr style='visibility:hidden;'><td></td></tr>
</tfoot>
<tbody style='page-break-inside:avoid;'>
<tr style='page-break-inside:avoid;border-bottom:1px solid black !important;'>
<td rowspan='1' style='page-break-inside:avoid;'><label>Večerja na zajli</label></td>
<td style=''>
<img src=http://localhost:53358/resources/Images/EAN128/VzlSSlNYVlo=.jpg><br/>
<label>VzlSSlNYVlo=</label><br/>
</td>
<td style=''><input type='checkbox'><br/><label></label><br/></td>
<td style='overflow: hidden; white-space: nowrap;' rowspan='1'>1,00</td>
<td style='overflow: hidden; white-space: nowrap;' rowspan='1'>KOM</td>
<td style='overflow: hidden; white-space: nowrap;' rowspan='1'>91,14 €</td>
<td style='overflow: hidden; white-space: nowrap;' rowspan='1'>91,14 €</td>
<td style='overflow: hidden; white-space: nowrap;' rowspan='1'>9,50 %</td>
<td style='overflow: hidden; white-space: nowrap;' rowspan='1'>8,66 €</td>
<td style='overflow: hidden; white-space: nowrap;' rowspan='1'>99,80 €</td>
</tr>
<tr style='page-break-inside:avoid;border-bottom:1px solid black !important;'>
<td rowspan='7' style='page-break-inside:avoid;'><label>Veliki kuharski mojster</label></td>
<td style='border-bottom-style:hidden;'>
<img src=http://localhost:53358/resources/Images/EAN128/TDZKVzRDVks=.jpg><br/>
<label>TDZKVzRDVks=</label><br/>
</td>
<td style='border-bottom-style:hidden;'><input type='checkbox'><br/><label></label><br/></td>
<td style='overflow: hidden; white-space: nowrap;' rowspan='7'>7,00</td>
<td style='overflow: hidden; white-space: nowrap;' rowspan='7'>KOM</td>
<td style='overflow: hidden; white-space: nowrap;' rowspan='7'>65,69 €</td>
<td style='overflow: hidden; white-space: nowrap;' rowspan='7'>459,83 €</td>
<td style='overflow: hidden; white-space: nowrap;' rowspan='7'>22,00 %</td>
<td style='overflow: hidden; white-space: nowrap;' rowspan='7'>101,16 €</td>
<td style='overflow: hidden; white-space: nowrap;' rowspan='7'>560,99 €</td>
</tr>
<tr style='page-break-inside:avoid;border-bottom:1px solid black !important;'>
<td style='border-bottom-style:hidden;'>
<img src=http://localhost:53358/resources/Images/EAN128/Q0U2RURCVks=.jpg><br/>
<label>Q0U2RURCVks=</label><br/>
</td>
<td style='border-bottom-style:hidden;'><input type='checkbox'><br/><label></label><br/></td>
</tr>
<tr style='page-break-inside:avoid;border-bottom:1px solid black !important;'>
<td style='border-bottom-style:hidden;'>
<img src=http://localhost:53358/resources/Images/EAN128/RFg0TVZXVks=.jpg><br/>
<label>RFg0TVZXVks=</label><br/>
</td>
<td style='border-bottom-style:hidden;'><input type='checkbox'><br/><label></label><br/></td>
</tr>
<tr style='page-break-inside:avoid;border-bottom:1px solid black !important;'>
<td style='border-bottom-style:hidden;'>
<img src=http://localhost:53358/resources/Images/EAN128/OFdGRTJLVks=.jpg><br/>
<label>OFdGRTJLVks=</label><br/>
</td>
<td style='border-bottom-style:hidden;'><input type='checkbox'><br/><label></label><br/></td>
</tr>
<tr style='page-break-inside:avoid;border-bottom:1px solid black !important;'>
<td style='border-bottom-style:hidden;'>
<img src=http://localhost:53358/resources/Images/EAN128/QlROR0NMVks=.jpg><br/>
<label>QlROR0NMVks=</label><br/>
</td>
<td style='border-bottom-style:hidden;'><input type='checkbox'><br/><label></label><br/></td>
</tr>
<tr style='page-break-inside:avoid;border-bottom:1px solid black !important;'>
<td style='border-bottom-style:hidden;'>
<img src=http://localhost:53358/resources/Images/EAN128/SjNYWkJOVks=.jpg><br/>
<label>SjNYWkJOVks=</label><br/>
</td>
<td style='border-bottom-style:hidden;'><input type='checkbox'><br/><label></label><br/></td>
</tr>
<tr style='page-break-inside:avoid;border-bottom:1px solid black !important;'>
<td style=''>
<img src=http://localhost:53358/resources/Images/EAN128/M0RFWURXVks=.jpg><br/>
<label>M0RFWURXVks=</label><br/>
</td>
<td style=''><input type='checkbox'><br/><label></label><br/></td>
</tr>
</tbody>
</table><br/>
<!--i marked this element with ID = middleSection (for script)-->
<div id="middleSection" style='page-break-inside:avoid;margin-bottom: 30px;'><!--EDIT-->
<label style='position:relative;left:0;font-size:12px;'>Specifikacija obračunanega davka, dokumenta št.:</label><br/>
<div id='divBottom' style='position:relative;width:100%;min-height:160px;'>
<table id='tblLeft'>
<th>Stopnja</th><th>Osnova za DDV</th><th>Znesek DDV</th><th>Vrednost z DDV</th>
<tr>
<td>9,5 %</td><td>91,14 €</td><td>8,66 €</td><td>99,80 €</td>
</tr><tr>
<td>22 %</td><td>459,83 €</td><td>101,16 €</td><td>560,99 €</td>
</tr>
</table>
<table id='tblRight'>
<tr style='border-bottom:1px solid black !important;'>
<td style='text-align:left;'><b>Skupaj brez DDV:</b></td><td style='text-align:right;'>550,97 €</td>
</tr>
<tr>
<td style='text-align:left;'><b>Osnova za DDV</b></td><td style='text-align:right;'>550,97 €</td>
</tr>
<tr style='border-bottom:1px solid black !important;'>
<td style='text-align:left;'><b>DDV:</b></td><td style='text-align:right;'>109,82 €</td>
</tr>
</table>
<label style='position:absolute;right:80px;bottom:20px;'><b>SKUPAJ:</b></label>
<label style='position:absolute;right:0;bottom:20px;'><b>660,79 €</b></label>
</div></div><br/><br/><br/>
<!--i added this to manualy break page when needed by script-->
<div id="break" style="line-height:1px;"> </div><!--EDIT-->
<!--i marked this element with ID = bottomSection (for script)-->
<div id="bottomSection" style='page-break-inside:avoid;'><!--EDIT-->
<font face="Verdana" >
<br>
<table cellspacing="0" cellpadding="0" style="width:900px;">
<tbody>
<tr>
<td style="width:500px">
BLAGO DOSTAVIL: ______________________<br/><br/>
Podpis<br/><br/>
Datum: ______________________
</td>
<td>
BLAGO PREVZEL: ______________________<br/><br/>
Podpis<br/><br/>
Datum: ______________________
</td>
</tr>
</tbody>
</table>
</font>
<font face="Verdana" size="1" >
<br /><br />
<table cellspacing="0" cellpadding="0" style="width:900px;">
<tbody>
<tr>
<td style="text-align:center">
<i>
testting d.o.o., testing, ID za DDV: testing, matična št.: testing
<br>
tel: +386 XXXXXXXXXX, fax: +386 1 XXXXXXXXX, e-mail: info#XXXX.si, web: www.xxxxxxx.si
<br>
Družba je vpisana pri okrožnem sodišču v Ljubljani, št. vpisa v registru: 1/XXXXX/00, ustanovni kapital: XX.000 EUR
<br>
Račun odprt pri NLB d.d., Iban: SIXXXXXXX, SWIFT-BIC: LJBASI2X
</i>
</td>
</tr>
</tbody>
</table>
</font>
</div>
</body>
<!--script-->
<!--EDIT-->
<script>
function fun()
{
var x = document.getElementById("tblArticles").scrollHeight; //825max for A3 / A4 /A5
var y = document.getElementById("middleSection").scrollHeight; //have 180px, but I suppose it height can wary - in dependcy on number of 'Stopnja' of 'DDV' you have in Slovenia?
var z = document.getElementById("bottomSection").scrollHeight; //have 224px, will not change, i suppose.
if ( x+y > 825 ) //if tblArticles height + middleSection height > 825px, break page and move your bottom section to be aligned (i am using margin-top for that) at the bottom of a new page.
{
//USE:
//1160px for EDGE & FIREFOX
//1110px for CHROME
//SAFARI & IE11 not tested, you must figure out.. ;-)
//It is possible to write a function for detection which browser is being used, but if only specific browser will be used in your use case, then there is no need for that.
document.getElementById("printStyle").innerHTML="#media print {#break {page-break-before:always;} #bottomSection {margin:1110px 0px 0px 0px;} }"
}
}
</script>
</html>
I used JavaScript to measure page height then decide to assign a transparent image height. So if the total page height is less than 1000px, then height of transparent image is zero and page-break-before:avoid are assumed, if the height of page is more than 1000px, height of transparent image will be 800px and page-break-before:always. So the section you want, goes to the bottom of next page. Below are changes into your code:
add #breakerdiv { page-break-before:always;} to <style>.
Define <div id="calc"> around above table, I mean <table id='tblArticles'>.
Change <div style='page-break-inside:avoid;vertical-align:bottom;'> to <div id="breakerdiv">.
Add
<img id="breaker" src="transparent-image.png" style="height: 10px; width: 400px;
position: relative;">
just after <div id="breakerdiv">. Use one transparent image on your own.
And add this <script> before </body>
<script>
var body = document.body,
html = document.documentElement;
var height = Math.max( body.scrollHeight, body.offsetHeight,
html.clientHeight, html.scrollHeight, html.offsetHeight );
if(height < 1000){document.getElementById("breaker").style.height="0";
document.getElementById("breakerdiv").style.pageBreakBefore="auto"};
if(height > 1000){document.getElementById("breaker").style.height="800px"};
</script>
I assumed your options are just one or two sheet. Rather than that, you should modify <script> for other heights.
If you mean you want that part stays at the same page, probably there is no room for that, you should try resizing elements. But if you want that part to be at bottom of next page:
Change this part:
<div style='page-break-inside:avoid;vertical-align:bottom;'>
to:
<div style="page-break-before: always; vertical-align: bottom;">
If vertical-align doesn't work on all the browsers, try some margin-top.

Display content to the right of a table

I am trying to develop a web page that has a table running down the left hand side of a div and then displays content on the right. I have the table setup, but for the life of me I cannot figure out how to display other content on the right (and not have it appear below the table).
Here is my code so far: http://jsfiddle.net/fZJnp/
I would like to have a usable area that takes up the remaining width in the 'content' div.
Here is the css that is applied to the content div and table respectively:
#content {
margin: 0 auto;
width:50%;
height:auto;
border:solid 1px #003366;
background-color:#FFF;
padding:10px;
-webkit-box-shadow: 0px 2px 2px 0px rgba(0,0,0,0.75), 0px -1px 2px 0px rgba(0,0,0,0.75);
-moz-box-shadow: 0px 2px 2px 0px rgba(0,0,0,0.75), 0px -1px 2px 0px rgba(0,0,0,0.75);
box-shadow: 0px 2px 2px 0px rgba(0,0,0,0.75), 0px -1px 2px 0px rgba(0,0,0,0.75);
}
table {
border-collapse: collapse;
background:#EEE;
color:#111;
}
Float:left, when applied to the table, seems to let me display information and other elements on the right, however it messes up other elements on the page.
Please let me know what you think, hopefully I explained my problem correctly.
Thanks in advance!
I would use two divs, a left and a right. Here is the HTML and CSS I used to make it work. You might want to check out the CSS framework "Bootstrap," released by Twitter. It makes it quite easy to achieve layouts like this using their prewritten stylesheets.
HTML:
<body>
<div id="left">
<table>
<thead>
<tr>
<th>Type</th>
<th>Destination</th>
</tr>
</thead>
<tbody>
<tr>
<td>A239</td>
<td class="Lowsec">Lowsec</td>
</tr>
<tr>
<td>A641</td>
<td class="Highsec">Highsec</td>
</tr>
<tr>
<td>A982</td>
<td class="C6">C6</td>
</tr>
<tr>
<td>B041</td>
<td class="C6">C6</td>
</tr>
<tr>
<td>B274</td>
<td class="Highsec">Highsec</td>
</tr>
<tr>
<td>B449</td>
<td class="Highsec">Highsec</td>
</tr>
<tr>
<td>C125</td>
<td class="C2">C2</td>
</tr>
<tr>
<td>C140</td>
<td class="Lowsec">Lowsec</td>
</tr>
<tr>
<td>C247</td>
<td class="C3">C3</td>
</tr>
<tr>
<td>C248</td>
<td class="Nullsec">Nullsec</td>
</tr>
<tr>
<td>C391</td>
<td class="Lowsec">Lowsec</td>
</tr>
<tr>
<td>D364</td>
<td class="C2">C2</td>
</tr>
<tr>
<td>D382</td>
<td class="C2">C2</td>
</tr>
<tr>
<td>D792</td>
<td class="Highsec">Highsec</td>
</tr>
<tr>
<td>D845</td>
<td class="Highsec">Highsec</td>
</tr>
<tr>
<td>E175</td>
<td class="C4">C4</td>
</tr>
<tr>
<td>E545</td>
<td class="Nullsec">Nullsec</td>
</tr>
<tr>
<td>G024</td>
<td class="C2">C2</td>
</tr>
<tr>
<td>H121</td>
<td class="C1">C1</td>
</tr>
<tr>
<td>H296</td>
<td class="C5">C5</td>
</tr>
<tr>
<td>H900</td>
<td class="C5">C5</td>
</tr>
<tr>
<td>I182</td>
<td class="C2">C2</td>
</tr>
<tr>
<td>J244</td>
<td class="Lowsec">Lowsec</td>
</tr>
<tr>
<td>K162</td>
<td class="Generic Exit">Generic Exit</td>
</tr>
<tr>
<td>K329</td>
<td class="Nullsec">Nullsec</td>
</tr>
<tr>
<td>K346</td>
<td class="Nullsec">Nullsec</td>
</tr>
<tr>
<td>L477</td>
<td class="C3">C3</td>
</tr>
<tr>
<td>L614</td>
<td class="C5">C5</td>
</tr>
<tr>
<td>M267</td>
<td class="C3">C3</td>
</tr>
<tr>
<td>M555</td>
<td class="C5">C5</td>
</tr>
<tr>
<td>M609</td>
<td class="C4">C4</td>
</tr>
<tr>
<td>N062</td>
<td class="C5">C5</td>
</tr>
<tr>
<td>N110</td>
<td class="Highsec">Highsec</td>
</tr>
<tr>
<td>N290</td>
<td class="Lowsec">Lowsec</td>
</tr>
<tr>
<td>N432</td>
<td class="C5">C5</td>
</tr>
<tr>
<td>N766</td>
<td class="C2">C2</td>
</tr>
<tr>
<td>N770</td>
<td class="C5">C5</td>
</tr>
<tr>
<td>N968</td>
<td class="C3">C3</td>
</tr>
<tr>
<td>N944</td>
<td class="Lowsec">Lowsec</td>
</tr>
<tr>
<td>O128</td>
<td class="C4">C4</td>
</tr>
<tr>
<td>O477</td>
<td class="C3">C3</td>
</tr>
<tr>
<td>O883</td>
<td class="C3">C3</td>
</tr>
<tr>
<td>P060</td>
<td class="C1">C1</td>
</tr>
<tr>
<td>Q317</td>
<td class="C1">C1</td>
</tr>
<tr>
<td>R051</td>
<td class="Lowsec">Lowsec</td>
</tr>
<tr>
<td>R474</td>
<td class="C6">C6</td>
</tr>
<tr>
<td>R943</td>
<td class="C2">C2</td>
</tr>
<tr>
<td>S047</td>
<td class="Highsec">Highsec</td>
</tr>
<tr>
<td>S199</td>
<td class="Nullsec">Nullsec</td>
</tr>
<tr>
<td>S804</td>
<td class="C6">C6</td>
</tr>
<tr>
<td>T405</td>
<td class="C4">C4</td>
</tr>
<tr>
<td>U210</td>
<td class="Lowsec">Lowsec</td>
</tr>
<tr>
<td>U319</td>
<td class="C6">C6</td>
</tr>
<tr>
<td>U574</td>
<td class="C6">C6</td>
</tr>
<tr>
<td>V283</td>
<td class="Nullsec">Nullsec</td>
</tr>
<tr>
<td>V301</td>
<td class="C1">C1</td>
</tr>
<tr>
<td>V753</td>
<td class="C6">C6</td>
</tr>
<tr>
<td>V911</td>
<td class="C5">C5</td>
</tr>
<tr>
<td>W237</td>
<td class="C6">C6</td>
</tr>
<tr>
<td>X702</td>
<td class="C3">C3</td>
</tr>
<tr>
<td>X877</td>
<td class="C4">C4</td>
</tr>
<tr>
<td>Y683</td>
<td class="C4">C4</td>
</tr>
<tr>
<td>Y709</td>
<td class="C1">C1</td>
</tr>
<tr>
<td>Z060</td>
<td class="Nullsec">Nullsec</td>
</tr>
<tr>
<td>Z142</td>
<td class="Nullsec">Nullsec</td>
</tr>
<tr>
<td>Z457</td>
<td class="C4">C4</td>
</tr>
<tr>
<td>Z647</td>
<td class="C1">C1</td>
</tr>
<tr>
<td>Z971</td>
<td class="C1">C1</td>
</tr>
</tbody>
</table></div><div id="right"><p>This is test content</p></div>
</div>
</body>
CSS:
#font-face {
font-family: 'Myriad Pro Regular';
font-style: normal;
font-weight: normal;
src: local('Myriad Pro Regular'), url('MYRIADPRO-REGULAR.woff') format('woff');
}
html {
font-family:'Myriad Pro Regular';
font-weight:normal;
background-color:#CCC;
}
#font-face {
font-family: 'Myriad Pro Regular';
font-style: normal;
font-weight: normal;
src: local('Myriad Pro Regular'), url('MYRIADPRO-REGULAR.woff') format('woff');
}
#left {
float:left;
width:50%;
}
#right {
float:right;
width:50%;
}
table {
border-collapse: collapse;
background:#EEE;
color:#111;
}
th, td {
border: solid 1px #222;
padding:5px;
}
tr:hover {
background:#CCC;
}
tr.highlight {
background:yellow;
}
td.Highsec, td.C1, td.C2 {
background-color:#468966;
}
td.Lowsec, td.C3, td.C4 {
background-color:#FFB03B;
}
td.Nullsec, td.C5, td.C6 {
background-color:#8E2800;
}
You can do it like this
HTML
<div id="content">
<div class="leftBar">
<!- your table goes here -->
</div>
<div class="rightCnt">
test test test tset
</div>
<div class="clear"></div>
</div>
CSS
.leftBar {
float: left;
}
.rightCnt {
margin-left: 150px
}
.clear {
clear: both
}

Space on html table

This is an easy question, but I cannot seem to solve it. My html table can be seen at the following:
http://jsfiddle.net/Rochefort/kvUKG/
And also included here:
<table style="background:#fff;width:300px;margin-left:14px;" class="form">
<tbody>
<tr style="">
<td class="bosluk"></td>
<td class="alis_baslik"><strong>ALIŞ</strong></td>
<td class="satis_baslik"><strong>SATIŞ</strong></td>
</tr>
<tr style="border-bottom:1px solid #e4e4e4;">
<td class="ikonlar"><strong>$ </strong></td>
<td class="kurlar">DOLAR</td>
<td class="alis">2.2804</td>
<td class="satis">2.2914</td>
</tr>
<tr style="border-bottom:1px solid #e4e4e4;">
<td class="ikonlar"><strong>$ </strong></td>
<td class="kurlar"><strong>DOLAR</strong></td>
<td class="alis">2.2804</td>
<td class="satis">2.2914</td>
</tr>
<tr style="border-bottom:1px solid #e4e4e4;">
<td class="ikonlar"><strong>$ </strong></td>
<td class="kurlar"><strong>DOLAR</strong></td>
<td class="alis">2.2804</td>
<td class="satis">2.2914</td>
</tr>
<tr style="border-bottom:1px solid #e4e4e4;">
<td class="ikonlar"><strong>$ </strong></td>
<td class="kurlar"><strong>DOLAR</strong></td>
<td class="alis">2.2804</td>
<td class="satis">2.2914</td>
</tr>
</tbody>
</table>
I implemented CSS but the DOLLAR item has too much space. How can I remove this extra space?
You can use text-align: right with padding-right instead of padding-left.
Example: http://jsfiddle.net/BfD2v/
.ikonlar {
padding-right:5px;
font-family: Arial;
font-size:12px;
font-weigth: bold;
color: #000;
text-align: right;
}
If you want to make the whole column narrower, you can set the width od the column with this:
.bosluk, .ikonlar {
width: 10px;
}
You should also probably use <th> tags for the headers. The columns would align themselves under the <td> tags then. Like:
<table border="1">
<tr>
<th>Month</th>
<th>Savings</th>
</tr>
<tr>
<td>January</td>
<td>$100</td>
</tr>
<tr>
<td>February</td>
<td>$80</td>
</tr>
</table>

When printing more than one page it breaks table between two pages

I am having a problem with a page because its longer than one page it break a table so it would be printed in two pages.
I would need to stop this from happening, but I don't know how.
I tried
table { page-break-inside:auto }
tr { page-break-inside:avoid; page-break-after:auto }
Which I saw in another question here but no luck so far.
I am working on IE7, but it has to work on IE6,IE7,IE8 mainly and others if possible.
Any recommendations?
Many thanks.
CSS
/*Universal selector:
This rule set will be applied to every element in a document:*/
*
{
margin:auto;
padding:auto;
/*text-align:center;*/
font-size:1em;
}
/*The folowing rule will help to minimaze the differences between browesers*/
h1,h2,h3,h4,h5,h6,pre,code,address,caption,cite,code,em,strong,th {font-weight:normal; font-style:normal;}
ul,ol {list-style:none;}
img {border:none;}
caption,th {text-align:left;}
table {
border-spacing:0;
font-size:1em;
font-weight:normal;
font-style:normal;
font-family:Times New Roman;
page-break-inside:avoid;
}
tr{
page-break-inside:avoid;
page-break-after:auto
}
.divTitle{
margin:10px;
}
}
.title
{
font-weight:bold;
color:#0076BF;
font-size:1.4em;
font-family:Times New Roman;
}
.divContainer
{
margin:10px;
background-color:#C7D8EE;
border:2px solid #0076BF;
text-align:left;
overflow:visible;
}
.tableContainer
{
color:#0076BF;
margin: -10px 0px -10px 0px;
border-spacing: 10px;
empty-cells:show;
width:90%;
}
.tableContainer tr td{
white-space:nowrap;
}
.tableContainerRow2{
background-color:white;
border:2px solid #0076BF;
}
.divBlueBarTitle{
margin:15px 10px -7px 10px;
background-color:#0076BF;
}
.divBlueBarTitle font{
font-size:1.2em;
font-family:Times New Roman;
font-weight:bold;
color:white;
text-indent:10px;
}
.divContainerWhite
{
margin:15px 10px 0px 10px;
background-color:white;
text-align:left;
}
.tableContainerWhite
{
color:#0076BF;
margin: 0px 0px 0px -10px;
border-spacing: 10px;
width:90%;
}
.tableContainerWhite td{
white-space:nowrap;
}
.footer {
margin-top:40px;
padding-bottom:20px;
font-family: Arial, Helvetica, sans-serif;
color: #303030;
line-height: normal;
font-size:smaller;
text-align:right;
width:95%;
}
HTML
<body>
<div class="divTitle">
<font class="title"> Maternity Diary Event</font>
</div>
<!--Maternity Diary Event-->
<div class="divContainer">
<table class="tableContainer" cellspacing="10px">
<tr>
<td>NHS Number</td>
<td> </td>
<td>Date of Visit</td>
<td> </td>
<td colspan="3">Care Time Started</td>
<td> </td>
<td> </td>
<td rowspan="2" style="font-weight:bold;vertical-align:middle;">Tick when<br/> care starts</td>
</tr>
<tr >
<td width="90" class="tableContainerRow2"> 
<xsl:value-of select="//MaternityDiaryEvent/NHSNumber"/>
</td>
<td > </td>
<td width="80" class="tableContainerRow2"> 12/12/09</td>
<td > </td>
<td width="40" class="tableContainerRow2"> 12</td>
<td width="5">:</td>
<td width="40" class="tableContainerRow2"> 10</td>
<td > </td>
<td style="text-align:right" > ☑</td>
</tr>
</table>
<table class="tableContainer" cellspacing="10px" >
<tr>
<td></td>
<td>Initials</td>
<td>Surname</td>
</tr>
<tr>
<td width="80" style="font-weight:bold;">Midwife</td>
<td width="50" class="tableContainerRow2"> </td>
<td class="tableContainerRow2"> </td>
</tr>
<tr>
<td></td>
<td>Initials</td>
<td>Surname</td>
</tr>
<tr>
<td style="font-weight:bold;">Doctor</td>
<td class="tableContainerRow2"> </td>
<td class="tableContainerRow2"> </td>
</tr>
</table>
<table class="tableContainer" cellspacing="10px" >
<tr>
<td width="250">Forename</td>
<td>Surname</td>
</tr>
<tr>
<td class="tableContainerRow2"> </td>
<td class="tableContainerRow2"> </td>
</tr>
</table>
<table class="tableContainer" cellspacing="10px" style="margin-bottom:10px;" >
<tr>
<td width="90">Date of Birth</td>
<td width="150"></td>
<td width="100">Casenote No:</td>
<td></td>
</tr>
<tr>
<td class="tableContainerRow2"> </td>
<td></td>
<td class="tableContainerRow2"> </td>
<td></td>
</tr>
</table>
</div>
<!--Site Visit-->
<div class="divBlueBarTitle">
<font>SITE VISIT</font>
</div>
<div class="divContainer">
<table class="tableContainer" cellspacing="10px" style="margin-bottom:10px;">
<tr>
<td>Home</td>
<td> ☑</td>
<td>Blake Maty Centre</td>
<td> ☑</td>
<td> </td>
<td> </td>
</tr>
<tr>
<td>Consultant ANC</td>
<td> ☑</td>
<td>Grange Maty Centre</td>
<td> ☑</td>
<td> </td>
<td> </td>
</tr>
<tr>
<td>Midwifery ANC</td>
<td> ☑</td>
<td>MRMC/B5</td>
<td> ☑</td>
<td></td>
<td></td>
</tr>
<tr>
<td>Day assessment Unit</td>
<td> ☑</td>
<td>Ports Maty Centre SMH</td>
<td> ☑</td>
<td></td>
<td></td>
</tr>
<tr>
<td>Labour Ward</td>
<td> ☑</td>
<td>Posnatal Ward</td>
<td> ☑</td>
<td></td>
<td></td>
</tr>
<tr>
<td>Antenatal Ward</td>
<td> ☑</td>
<td>Telephone Assessment</td>
<td> ☑</td>
<td>Other(give reason below)</td>
<td> ☑</td>
</tr>
<tr>
<td class="tableContainerRow2" colspan="6" rowspan="2"> </td>
</tr>
</table>
</div>
<div class="divContainerWhite">
<table class="tableContainerWhite" cellspacing="10px" style="font-size:1.1em;">
<tr>
<td style="text-decoration:underline;font-weight:bold;white-space:nowrap;">Reason for Contact Booking:</td>
<td> </td>
<td width="150" style="font-weight:bold;">Gestation: Weeks:</td>
<td width="30" class="tableContainerRow2"> </td>
<td width="50" style="font-weight:bold;">Days:</td>
<td width="30" class="tableContainerRow2"> </td>
<td > </td>
</tr>
</table>
<table class="tableContainerWhite" cellspacing="10px">
<tr>
<td >Choice of Birth Offered</td>
<td> ☑</td>
<td >Domestic Violence Identified</td>
<td> ☑</td>
<td >Late Booker (> 11Wks 6 Days)</td>
<td> ☑</td>
</tr>
<tr>
<td style="white-space:nowrap">Contact Number Provided</td>
<td> ☑</td>
<td style="white-space:nowrap">Safeguarding Children identified</td>
<td> ☑</td>
<td> </td>
<td> </td>
</tr>
</table>
</div>
<div class="divContainer">
<table class="tableContainer" cellspacing="10px">
<tr>
<td colspan="4" style="font-size:1.1em;text-decoration:underline;font-weight:bold;">Reason For Late Booking</td>
</tr>
<tr>
<td width="200">Woman booked herself late</td>
<td> ☑</td>
<td colspan="4" style="white-space:nowrap;"> ☑ Other (give reason below)</td>
</tr>
<tr>
<td>Recently moved to area</td>
<td> ☑</td>
<td rowspan="3" colspan="5" class="tableContainerRow2" > </td>
</tr>
<tr>
<td>Transferred from another hospital</td>
<td> ☑</td>
</tr>
<tr>
<td>Late booking by Midwife</td>
<td> ☑</td>
</tr>
<tr>
<td>Intrapartum</td>
<td> ☑</td>
<td>Posnatal Admission</td>
<td colspan="4"> ☑</td>
</tr>
<tr>
<td>Antenatal Admision</td>
<td> ☑</td>
<td>Intrauterine Transfer</td>
<td colspan="4"> ☑</td>
</tr>
<tr>
<td >Antenatal Check Routine</td>
<td > ☑</td>
<td style="white-space:nowrap;font-weight:bold;">Gestation: Weeks:</td>
<td width="30" class="tableContainerRow2"> </td>
<td style="font-weight:bold;">Days:</td>
<td width="30" class="tableContainerRow2"> </td>
<td > </td>
</tr>
<tr>
<td>Postnatal Check Routine</td>
<td> ☑</td>
<td colspan="2">Postnatal Check Other</td>
<td> ☑</td>
<td>Day</td>
<td width="30" class="tableContainerRow2"> </td>
</tr>
</table>
<table class="tableContainer" cellspacing="10px">
<tr>
<td width="20%">Details</td>
<td class="tableContainerRow2"> </td>
</tr>
</table>
<table class="tableContainer" cellspacing="10px">
<tr>
<td style="white-space:nowrap">Consultant Appt Made</td>
<td>YES</td>
<td> ☑</td>
<td>NO</td>
<td> ☑</td>
<td width="50%"></td>
</tr>
</table>
</div>
<div class="divContainerWhite">
<table class="tableContainerWhite" cellspacing="10px">
<tr>
<td style="text-decoration:underline;font-size:1.1em;font-weight:bold;">Baby</td>
<td>Routine Check:</td>
<td> ☑</td>
<td>Other Check</td>
<td> ☑</td>
<td>Day</td>
<td width="30" class="tableContainerRow2"> </td>
<td> </td>
</tr>
<tr>
<td colspan="9">Details</td>
</tr>
<tr>
<td colspan="9" class="tableContainerRow2"> </td>
</tr>
</table>
<table class="tableContainerWhite" cellspacing="10px">
<tr>
<td colspan="6" style="font-size:1.1em;font-weight:bold">PUK</td>
</tr>
<tr>
<td>Weight</td>
<td> ☑</td>
<td >SBR</td>
<td> ☑</td>
<td > </td>
<td> </td>
</tr>
<tr>
<td style="white-space:nowrap">Feeding Advice</td>
<td> ☑</td>
<td>Jaundice</td>
<td> ☑</td>
<td> ☑</td>
<td>TICK ON LEAVING LOCATION</td>
</tr>
</table>
</div>
<!--Footer-->
<div class="footer">
© 2009 Graphnet Health Ltd. All rights reserved. | Disclaimer
</div>
</body>
If it fits on a single page and you always want it to be on a single page, then I would try specifying page-break-before: always. This would force 2 pages at times when it possibly could have fit on one, but it should always keep the table on a single page, providing it fits.