I am trying make a gallery in a html template using PHP loop.
But I having to write the gallery as a fixed table, so using <td> for each image and spacing element. And then on a new row, it creates a new table.
I guess I'm doing this to avoid any issues in old Outlook.
I've created my solid html layout, this is how I need it to output, see below...
<!-- 1st row -->
<table border="0" cellspacing="0" cellpadding="0" style="width: 579px;" align="center">
<tr>
<td style="width: 135px; height: 148px;" valign="top">
<img src="img/image-1.jpg" height="135" width="135" style="width: 135px; height: 135px; background: red;" alt="" />
</td>
<td style="width: 13px; height: 148px;"><!-- space --></td>
<td style="width: 135px; height: 148px;" valign="top">
<img src="img/image-2.jpg" height="135" width="135" style="width: 135px; height: 135px; background: red;" alt="" />
</td>
<td style="width: 13px; height: 148px;"><!-- space --></td>
<td style="width: 135px; height: 148px;" valign="top">
<img src="img/image-3.jpg" height="135" width="135" style="width: 135px; height: 135px; background: red;" alt="" />
</td>
<td style="width: 13px; height: 148px;"><!-- space --></td>
<td style="width: 135px; height: 148px;" valign="top">
<img src="img/image-4.jpg" height="135" width="135" style="width: 135px; height: 135px; background: red;" alt="" />
</td>
</tr>
</table>
<!-- 2nd row -->
<table border="0" cellspacing="0" cellpadding="0" style="width: 579px;" align="center">
<tr>
<td style="width: 135px; height: 148px;" valign="top">
<img src="img/image-5.jpg" height="135" width="135" style="width: 135px; height: 135px; background: red;" alt="" />
</td>
<td style="width: 13px; height: 148px;"><!-- space --></td>
<td style="width: 135px; height: 148px;" valign="top">
<img src="img/image-6.jpg" height="135" width="135" style="width: 135px; height: 135px; background: red;" alt="" />
</td>
<td style="width: 13px; height: 148px;"><!-- space --></td>
<td style="width: 135px; height: 148px;" valign="top">
<img src="img/image-7.jpg" height="135" width="135" style="width: 135px; height: 135px; background: red;" alt="" />
</td>
<td style="width: 13px; height: 148px;"><!-- space --></td>
<td style="width: 135px; height: 148px;" valign="top">
<img src="img/image-8.jpg" height="135" width="135" style="width: 135px; height: 135px; background: red;" alt="" />
</td>
</tr>
</table>
Which outputs this...
My problem I am having is that I can have from 1 to a unlimited amount of images in my gallery.
So my PHP is little more complicated to write.
This is my attempt below but is a bit ropey.
<?php
$images = get_field('image_thumbnails');
if( $images ): ?>
<?php $count = 0; ?>
<table border="0" cellspacing="0" cellpadding="0" style="width: 579px;" align="center">
<tr>
<?php foreach( $images as $image ): $count++ ?>
<td style="width: 135px; height: 148px;" valign="top">
<img src="<?php echo $image['sizes']['thumbnail']; ?>" alt="<?php echo $image['alt']; ?>" height="135" width="135" style="width: 135px; height: 135px; border: none;" />
</td>
<?php if ($count %4 == 0) { ?>
</tr>
</table>
<table border="0" cellspacing="0" cellpadding="0" style="width: 579px;" align="center">
<tr>
<?php } else { ?>
<td style="width: 13px; height: 148px;"><!-- space --></td>
<?php } ?>
<?php endforeach; ?>
</tr>
</table>
<?php endif;
?>
Please see my testings using this code with:
4 images
I get this error: end tag for "tr" which is not finished
3 images
Valid no errors but looks weird cause it spaces out
6 images
Valid no errors but looks weird cause it spaces out
1 image
Valid and aligns to the left... weird.
My question can any one help me come with a PHP loop at works better than mine and does not leave any syntax errors with any given image count?
use array_chunk:
$images = get_field('image_thumbnails');
if( $images ) {
$count = count( $images );
for( $i =0; $i < $count % 4; $i++ ) {
// align array
array_push($images, array());
}
$rows = array_chunk($images, 4);
?>
<table border="0" cellspacing="0" cellpadding="0" style="width: 579px;" align="center">
<?
foreach( $rows as $row ) {
?><tr><?
foreach ($row as $image) {
?>
<td style="width: 135px; height: 148px;" valign="top">
<? if ( empty( $image ) ) {
?> <?
} else {
?><img src="<?php echo $image['sizes']['thumbnail']; ?>" alt="<?php echo $image['alt']; ?>" height="135" width="135" style="width: 135px; height: 135px; border: none;" /><?
}
?>
</td>
<?
}
?></tr><?
}
?>
</table>
<?
}
Try this solution,..
I am not writing the whole code but giving you some logic to implement your desired layout..
<?php
$count = ceil(mysql_num_rows($query)); //number of tables
for($i=0;$i<$count;$i++)
{
?>
<table>
<tr>
<?php
$num = $j*4;
for($j=($num);$j<($num+3);$j++)
{
echo "<td><img src='".$image."'></td>"
}
</tr>
</table>
}
?>
Related
I am using simple_html_dom to gather data from another website and I am wondering how I can do a foreach for only the data as an a element.
$url = 'example.com';
html2 = file_get_html($url);
$download2 = $html2->find('table',1);
$data['ep_table'] = $download2->outertext;
The above code returns the following.
<table style="height: 341px;">
<tbody>
<tr style="height: 31px;">
<td style="height: 31px; width: 26px;">#</td>
<td style="height: 31px; width: 196px;">Song</td>
<td style="text-align: right; height: 31px; width: 82px;">Download</td>
</tr>
<tr style="height: 62px;">
<td style="height: 62px; width: 26px;">1</td>
<td style="height: 62px; width: 196px;">미쳐가지고 (I’m Crazy)</td>
<td style="text-align: right;height: 62px;width: 82px;">
<a href="http://example.com/South-Club-im-crazy/"
target="_blank"
rel="noopener">
<strong>
<button class="button_rbox" title="" type="button">
<span class="cnt">Download</span>
</button>
</strong>
</a>
</td>
</tr>
<tr style="height: 31px;">
<td style="height: 31px; width: 26px;">2</td>
<td style="height: 31px; width: 196px;">Someday</td>
<td style="text-align: right; height: 31px; width: 82px;">
<a href="http://example.com/South-Club-someday/"
target="_blank"
rel="noopener">
<strong>
<button class="button_rbox" title="" type="button">
<span class="cnt">Download</span>
</button>
</strong>
</a>
</td>
</tr>
<tr style="height: 93px;">
<td style="height: 93px; width: 26px;">3</td>
<td style="height: 93px; width: 196px;">안녕 (Hi/Bye)</td>
<td style="text-align: right; height: 93px; width: 82px;">
<a href="http://example.com/South-Club-hi/"
target="_blank"
rel="noopener">
<strong>
<button class="button_rbox" title="" type="button">
<span class="cnt">Download</span>
</button>
</strong>
</a>
</td>
</tr>
<tr style="height: 31px;">
<td style="width: 26px; height: 31px;">4</td>
<td style="width: 196px; height: 31px;">빗방울 (Raindrop)</td>
<td style="text-align: right; width: 82px; height: 31px;">
<a href="http://example.com/South-Club-raindrop/"
target="_blank" rel="noopener">
<strong>
<button class="button_rbox" title="" type="button">
<span class="cnt">Download</span></button>
</strong>
</a>
</td>
</tr>
</tbody>
</table>
How can I do a foreach, which searches only the html of $data['ep_table'] and not the entire page we're parsing for a a element?
I've tried this, with no luck.
foreach($data['ep_table']->find('a') as $track){
print $link = $track->href;
}
You're trying to use find() on plaintext, not a DOM object. You should do this:
$url = 'example.com';
html2 = file_get_html($url);
foreach( $html2->find('table', 1)->find('a') as $track)
{
echo $track->href;
}
It's also worth pointing out that find('table', 1) assumes the target table is the second <table> element in the retrieved markup.
i have been searching on net to get an infographic email template to send email using PHP. Can we have functionalities like moving HTML content within the Email body or like popups within the email body on click event. Basically show and hide of HTML content will do.
Any sites or URLs which have achieved this can be very helpful for me to go forward with this development.
See the sample code below: (But the style gets removed in Gmail :( )
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml" xmlns:v="urn:schemas-microsoft-com:vml" xmlns:o="urn:schemas-microsoft-com:office:office">
<head>
<!-- This code is part of a tutorial from Email on Acid: https://www.emailonacid.com/blog/article/email-development/build-an-interactive-carousel-for-email -->
<title>Interactive Carousel</title>
<!--[if !mso]><!-->
<meta http-equiv="X-UA-Compatible" content="IE=edge" />
<!--<![endif]-->
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<meta name="viewport" content="width=device-width, initial-scale=1.0, maximum-scale=1.0, user-scalable=no" />
<style type="text/css">
#media only screen and (-webkit-min-device-pixel-ratio: 1), (min--moz-device-pixel-ratio: 1), (max-width: 480px), (max-device-width: 480px) {
.slide1-content,
.slide2-content,
.slide3-content {
display: block;position: absolute;top: 0px;left: 0px;width: 600px;height: 520px;background-color: #FFFFFF;
}
}
#media only screen and (-webkit-min-device-pixel-ratio: 1), (min--moz-device-pixel-ratio: 1) {
.slide1-content {left: 0px;}
.slide1:hover { background-color: #37B330;}
#slide-1:checked ~ .slide1 {background-color: #37B330 !important;}
#slide-1:checked + span + table .swoosh { left: 0px !important; }
.slide2 { top: 66px; left: 321px; }
.slide2-content { left: 600px; }
.slide2:hover { background-color: #37B330;}
#slide-2:checked ~ .slide2 {background-color: #37B330 !important;}
#slide-2:checked + span + table .swoosh { left: -600px !important; }
.slide3 { top: 122px; left: 321px; }
.slide3-content { left: 1200px; }
.slide3:hover { background-color: #37B330;}
#slide-3:checked ~ .slide3 {background-color: #37B330 !important;}
#slide-3:checked + span + table .swoosh { left: -1200px !important; }
}
</style>
</head>
<body style="background-color:#6c6c6c;margin: 0px;padding: 0px;" bgcolor="#6c6c6c">
<table width="100%" border="0" cellpadding="0" cellspacing="0" bgcolor="#6c6c6c" style="width: 100% !important; table-layout:fixed;mso-table-lspace: 0pt;mso-table-rspace: 0pt;">
<tr>
<td valign="top" align="center" style="border-collapse: collapse;">
<div class="wrapper" style="min-width: 640px;">
<table id="CarouselWrapper" width="600" border="0" cellpadding="0" cellspacing="0" bgcolor="#ffffff" class="shrink" style="width:600px; margin:0 auto;mso-table-lspace: 0pt;mso-table-rspace: 0pt;width: 415px !important;height: 895px !important;position: relative;display: block;overflow: hidden;">
<tr>
<td style="border-collapse: collapse;">
<table class="CarouselMain" width="600" bgcolor="#FFFFFF" cellpadding="0" cellspacing="0" style="border-collapse:collapse;mso-table-lspace: 0pt;mso-table-rspace: 0pt;width: 600px !important;height: 1400px !important;">
<tr>
<td valign="top" style="border-collapse: collapse;">
<table border="0" cellpadding="0" cellspacing="0" style="mso-table-lspace: 0pt;mso-table-rspace: 0pt;">
<tr>
<td style="line-height:1px; font-size:0px;border-collapse: collapse;">
<!--[if mso]><p style="display: none;"><![endif]-->
<form action ="foo">
<input class="yahoo" type="radio" name="action" checked="checked" id="slide-1" style="display: none!important; max-height: 0; visibility: hidden;" />
<span style></span>
<!--[if mso]></p><![endif]-->
<table border="0" cellpadding="0" cellspacing="0" style="mso-table-lspace: 0pt;mso-table-rspace: 0pt;">
<tr>
<td style="line-height:1px; font-size:0px;border-collapse: collapse;">
<!--[if mso]><p style="display: none;"><![endif]-->
<input class="yahoo" type="radio" name="action" id="slide-2" style="display: none!important; max-height: 0; visibility: hidden;" />
<span style></span>
<!--[if mso]></p><![endif]-->
<table border="0" cellpadding="0" cellspacing="0" style="mso-table-lspace: 0pt;mso-table-rspace: 0pt;">
<tr>
<td style="line-height:1px; font-size:0px;border-collapse: collapse;">
<!--[if mso]><p style="display: none;"><![endif]-->
<input class="yahoo" type="radio" name="action" id="slide-3" style="display: none!important; max-height: 0; visibility: hidden;" />
<span style></span>
</form>
<!--[if mso]></p><![endif]-->
<table border="0" cellpadding="0" cellspacing="0" style="mso-table-lspace: 0pt;mso-table-rspace: 0pt;">
<tr>
<td style="border-collapse: collapse;">
<table class="swoosh" border="0" cellpadding="0" cellspacing="0" style="mso-table-lspace: 0pt;mso-table-rspace: 0pt;position: relative;transition: all 0.3s ease-out;-webkit-transition: all 0.3s ease-out;-moz-transition: all 0.3s ease-out;-ms-transition: all 0.3s ease-out;-o-transition: all 0.3s ease-out;">
<tr>
<td class="slide1-content" style="border-collapse: collapse;display: block;position: absolute;top: 0px;left: 0px;width: 600px;height: 520px;background-color: #FFFFFF">
<table width="100%" border="0" cellpadding="0" cellspacing="0" style="mso-table-lspace: 0pt;mso-table-rspace: 0pt;">
<tr>
<td valign="top" height="320" style="border-collapse: collapse;">
<img style="border: none !important;" src="https://www.emailonacid.com/images/emails/carousel/image3.jpg" width="320" />
</td>
</tr>
</table>
</td>
</tr>
<tr>
<td height="10" style="line-height:1px;font-size:1px;display:block;border-collapse: collapse;"> </td>
</tr>
<tr>
<td class="slide2-content" style="border-collapse: collapse;">
<table width="100%" border="0" cellpadding="0" cellspacing="0" style="mso-table-lspace: 0pt;mso-table-rspace: 0pt;">
<tr>
<td valign="top" height="320" style="border-collapse: collapse;">
<img style="border: none !important;" src="https://www.emailonacid.com/images/emails/carousel/image2.jpg" width="320" />
</td>
</tr>
</table>
</td>
</tr>
<tr>
<td height="10" style="line-height:1px;font-size:1px;display:block;border-collapse: collapse;"> </td>
</tr>
<tr>
<td class="slide3-content" style="border-collapse: collapse;">
<table width="100%" border="0" cellpadding="0" cellspacing="0" style="mso-table-lspace: 0pt;mso-table-rspace: 0pt;">
<tr>
<td valign="top" height="320" style="border-collapse: collapse;">
<img style="border: none !important;" src="https://www.emailonacid.com/images/emails/carousel/image4.jpg" width="320" />
</td>
</tr>
</table>
</td>
</tr>
<tr>
<td height="10" style="line-height:1px;font-size:1px;display:block;border-collapse: collapse;"> </td>
</tr>
</table>
</td>
</tr>
</table>
<label class="button slide3" for="slide-3" style="display: none; max-height: 0; visibility: hidden; font-size:1px; line-height:1px;visibility: visible !important;max-height: 46px !important;width: 86px !important;padding:7px 0px 6px 0px;display: block !important;position: absolute !important;text-align: center;z-index: 7;background-color: #262626;box-sizing: content-box;color: #ffffff !important;font-family: Arial, Helvetica, sans-serif;font-size: 13px !important;line-height:16px !important;font-weight:bold;cursor:pointer;-webkit-transition: 0.1s ease-in;-moz-transition: 0.1s ease-in;-ms-transition: 0.1s ease-in;-o-transition: 0.1s ease-in;">
<span class="hide" style="color:#ffffff;">Three</span>
</label>
</td>
</tr>
</table>
<label class="button slide2" for="slide-2" style="display: none; max-height: 0; visibility: hidden; font-size:1px; line-height:1px;visibility: visible !important;max-height: 46px !important;width: 86px !important;padding:7px 0px 6px 0px;display: block !important;position: absolute !important;text-align: center;z-index: 7;background-color: #262626;box-sizing: content-box;color: #ffffff !important;font-family: Arial, Helvetica, sans-serif;font-size: 13px !important;line-height:16px !important;font-weight:bold;cursor:pointer;-webkit-transition: 0.1s ease-in;-moz-transition: 0.1s ease-in;-ms-transition: 0.1s ease-in;-o-transition: 0.1s ease-in;">
<span class="hide" style="color:#ffffff;">Two</span>
</label>
</td>
</tr>
</table>
<label class="button slide1" for="slide-1" style="display: none; max-height: 0; visibility: hidden; font-size:1px; line-height:1px;visibility: visible !important;max-height: 46px !important;width: 86px !important;padding:7px 0px 6px 0px;display: block !important;position: absolute !important;text-align: center;z-index: 7;background-color: #262626;box-sizing: content-box;color: #ffffff !important;font-family: Arial, Helvetica, sans-serif;font-size: 13px !important;line-height:16px !important;font-weight:bold;cursor:pointer;-webkit-transition: 0.1s ease-in;-moz-transition: 0.1s ease-in;-ms-transition: 0.1s ease-in;-o-transition: 0.1s ease-in;top: 10px; left: 321px;">
<span class="hide" style="color:#ffffff;">One</span>
</label>
</td>
</tr>
</table>
</td>
</tr>
</table>
</td>
</tr>
</table>
</div>
</td>
</tr>
</table>
</body>
</html>
NB:
Is it possible to add dynamic moving content ie show and hide div elements within the Email body.
it's not possible to send scripts per Mail because of security issues. Also many of the major Mail Clients, like you noticed in Gmail, dont't support most of the simplest Html and Css.
Css animation works in some Clients, in others work gifs, but scripts wont work in any. Maybe you can design a workaround using this Recource. Css animation are complicated to design, pretty annoying to build, but can hide elements or move them around, if supported by the client.
Also you could have the button, that would start the animation, link to a webpage, where the animation will be. But in my expirience, this gives a terrible Usebility.
If most of your audience uses Outlook, its not worth to create something with Animations at all since Outlook doesn't support any of this.
Hope this was helpful!
Closed. This question needs to be more focused. It is not currently accepting answers.
Want to improve this question? Update the question so it focuses on one problem only by editing this post.
Closed 7 years ago.
Improve this question
I am having trouble with my alignment issues for my headers on my website,
http://questdesign.com.au/index.php/folio
Here is the code for my Folio page.
<table>
<tbody>
<tr>
<td><img src="images/quest_design_folio_web_header.png" alt="" width="954" height="51" /></td>
</tr>
</tbody>
</table>
<table style="height: 23px;" width="985">
<tbody>
<tr>
<td><img style="display: block; margin-left: auto; margin-right: auto;" src="http://www.questdesign.com.au/images/quest_design_folio_websites_subheader.png" alt="" width="895" height="45" /></td>
</tr>
</tbody>
</table>
<table style="height: 23px;" width="981">
<tbody>
<tr>
<td> </td>
<td> </td>
<td> </td>
<td><img style="display: block; margin-left: auto; margin-right: auto;" src="http://www.questdesign.com.au/images/quest_design_allison_driscoll_author_ebook_website.jpg" alt="" width="144" height="180" /></td>
<td><img style="display: block; margin-left: auto; margin-right: auto;" src="http://www.questdesign.com.au/images/headers/quest_design_ironmonger_heavy_metal_rock_music_website.jpg" alt="" width="160" height="180" /></td>
<td><img style="display: block; margin-left: auto; margin-right: auto;" src="http://www.questdesign.com.au/images/headers/quest_design_kate_brock_personal_trainer_website.jpg" alt="" width="160" height="180" /></td>
<td><img style="display: block; margin-left: auto; margin-right: auto;" src="http://www.questdesign.com.au/images/headers/quest_design_silence_no_more_music_website.jpg" alt="" width="160" height="180" /></td>
<td> </td>
<td> </td>
<td> </td>
</tr>
</tbody>
</table>
<p> </p>
<table style="height: 23px;" width="983">
<tbody>
<tr>
<td><img style="display: block; margin-left: auto; margin-right: auto;" src="images/quest_design_folio_social_media_subheader.png" alt="" width="895" height="45" /></td>
</tr>
</tbody>
</table>
<table style="height: 23px;" width="984">
<tbody>
<tr>
<td> </td>
<td> </td>
<td> </td>
<td><img style="display: block; margin-left: auto; margin-right: auto;" src="http://www.questdesign.com.au/images/headers/quest_design_emmerson_legal_social_media_branding.jpg" alt="" width="180" height="89" /></td>
<td><img style="display: block; margin-left: auto; margin-right: auto;" src="http://www.questdesign.com.au/images/headers/quest_design_kate_brock_personal_trainer_social_media_branding.jpg" alt="" width="180" height="89" /></td>
<td><img style="display: block; margin-left: auto; margin-right: auto;" src="http://www.questdesign.com.au/images/headers/quest_design_lifestyle_maximiser_social_media_branding.jpg" alt="" width="180" height="85" /></td>
<td><img style="display: block; margin-left: auto; margin-right: auto;" src="http://www.questdesign.com.au/images/headers/quest_design_rock_solid_personal_training_social_media_branding.jpg" alt="" width="180" height="85" /></td>
<td> </td>
<td> </td>
<td> </td>
</tr>
</tbody>
</table>
<p> </p>
<table style="height: 23px;" width="982">
<tbody>
<tr>
<td><img style="display: block; margin-left: auto; margin-right: auto;" src="images/quest_design_folio_online_marketing_material_subheader.png" alt="" /></td>
</tr>
</tbody>
</table>
<table style="height: 23px;" width="982">
<tbody>
<tr>
<td> </td>
<td> </td>
<td> </td>
<td><img style="display: block; margin-left: auto; margin-right: auto;" src="http://www.questdesign.com.au/images/headers/quest_design_adam_quinn_social_media_marketing.jpg" alt="" width="180" height="97" /></td>
<td><img style="display: block; margin-left: auto; margin-right: auto;" src="http://www.questdesign.com.au/images/headers/quest_design_allison_driscoll_author_ebook_social_media_marketing.jpg" alt="" width="180" height="122" /></td>
<td><img style="display: block; margin-left: auto; margin-right: auto;" src="http://www.questdesign.com.au/images/headers/quest_design_emmerson_legal_social_media_marketing.jpg" alt="" width="180" height="113" /></td>
<td><img style="display: block; margin-left: auto; margin-right: auto;" src="http://www.questdesign.com.au/images/headers/quest_design_kate_brock_personal_trainer_social_media_marketing.jpg" alt="" width="180" height="135" /></td>
<td> </td>
<td> </td>
<td> </td>
</tr>
</tbody>
</table>
<p> </p>
<p> </p>
<table>
<tbody>
<tr>
<td><img src="images/quest_design_folio_design_header.png" alt="" width="954" height="51" /></td>
</tr>
</tbody>
</table>
<table style="height: 23px;" width="981">
<tbody>
<tr>
<td><img style="display: block; margin-left: auto; margin-right: auto;" src="http://www.questdesign.com.au/images/quest_design_folio_logos_subheader.png" alt="" /></td>
</tr>
</tbody>
</table>
<table style="height: 23px;" width="981">
<tbody>
<tr>
<td> </td>
<td> </td>
<td> </td>
<td><img style="display: block; margin-left: auto; margin-right: auto;" src="http://www.questdesign.com.au/images/headers/quest_design_australian_academy_kung_fu_logo.jpg" alt="" width="180" height="141" /></td>
<td><img style="display: block; margin-left: auto; margin-right: auto;" src="http://www.questdesign.com.au/images/headers/quest_design_kettlebell_strength_logo.jpg" alt="" width="180" height="180" /></td>
<td><img style="display: block; margin-left: auto; margin-right: auto;" src="http://www.questdesign.com.au/images/headers/quest_design_rawgasm_logo.jpg" alt="" width="180" height="57" /></td>
<td><img style="display: block; margin-left: auto; margin-right: auto;" src="http://www.questdesign.com.au/images/headers/quest_design_rock_solid_personal_training_logo.jpg" alt="" width="180" height="90" /></td>
<td> </td>
<td> </td>
<td> </td>
</tr>
</tbody>
</table>
<p> </p>
<table style="height: 23px;" width="979">
<tbody>
<tr>
<td><img style="display: block; margin-left: auto; margin-right: auto;" src="http://www.questdesign.com.au/images/quest_design_folio_business_cards_subheader.png" alt="" /></td>
</tr>
</tbody>
</table>
<table style="height: 23px;" width="978">
<tbody>
<tr>
<td> </td>
<td> </td>
<td> </td>
<td><img style="display: block; margin-left: auto; margin-right: auto;" src="http://www.questdesign.com.au/images/headers/quest_design_emmerson_legal_business_card.jpg" alt="" width="180" height="110" /></td>
<td><img style="display: block; margin-left: auto; margin-right: auto;" src="http://www.questdesign.com.au/images/headers/quest_design_mickyfit_training_business_card.jpg" alt="" width="180" height="110" /></td>
<td><img style="display: block; margin-left: auto; margin-right: auto;" src="http://www.questdesign.com.au/images/headers/quest_design_rawgasm_business_card.jpg" alt="" width="180" height="110" /></td>
<td><img style="display: block; margin-left: auto; margin-right: auto;" src="http://www.questdesign.com.au/images/headers/quest_design_rock_solid_personal_training_business_card.jpg" alt="" width="180" height="110" /></td>
<td> </td>
<td> </td>
<td> </td>
</tr>
</tbody>
</table>
<p> </p>
<table style="height: 23px;" width="980">
<tbody>
<tr>
<td><img style="display: block; margin-left: auto; margin-right: auto;" src="http://www.questdesign.com.au/images/quest_design_folio_flyers_brochures_subheader.png" alt="" /></td>
</tr>
</tbody>
</table>
<table style="height: 23px;" width="979">
<tbody>
<tr>
<td> </td>
<td> </td>
<td> </td>
<td style="text-align: center;"><img src="http://www.questdesign.com.au/images/headers/quest_design_emmerson_legal_flyer.jpg" alt="" width="180" height="85" /></td>
<td><img style="display: block; margin-left: auto; margin-right: auto;" src="http://www.questdesign.com.au/images/headers/quest_design_fifth_dimension_music_rave_flyer.jpg" alt="" width="85" height="180" /></td>
<td><img style="display: block; margin-left: auto; margin-right: auto;" src="http://www.questdesign.com.au/images/headers/quest_design_kate_brock_personal_trainer_flyer.jpg" alt="" width="180" height="85" /></td>
<td><img style="display: block; margin-left: auto; margin-right: auto;" src="http://www.questdesign.com.au/images/headers/quest_design_rawgasm_flyer.jpg" alt="" width="85" height="180" /></td>
<td> </td>
<td> </td>
<td> </td>
</tr>
</tbody>
</table>
<p> </p>
<table style="height: 23px;" width="979">
<tbody>
<tr>
<td><img style="display: block; margin-left: auto; margin-right: auto;" src="http://www.questdesign.com.au/images/quest_design_folio_book_covers_subheader.png" alt="" /></td>
</tr>
</tbody>
</table>
<table style="height: 23px;" width="979">
<tbody>
<tr>
<td> </td>
<td> </td>
<td> </td>
<td><img style="display: block; margin-left: auto; margin-right: auto;" src="http://www.questdesign.com.au/images/headers/quest_design_beginners_guide_to_bodybuilding_book_cover.jpg" alt="" width="124" height="180" /></td>
<td><img style="display: block; margin-left: auto; margin-right: auto;" src="http://www.questdesign.com.au/images/headers/quest_design_blades_of_the_fae_book_cover.jpg" alt="" width="127" height="180" /></td>
<td><img style="display: block; margin-left: auto; margin-right: auto;" src="http://www.questdesign.com.au/images/headers/quest_design_carpentry_bible_book_cover.jpg" alt="" width="127" height="180" /></td>
<td><img style="display: block; margin-left: auto; margin-right: auto;" src="http://www.questdesign.com.au/images/headers/quest_design_drifter_book_cover.jpg" alt="" width="120" height="180" /></td>
<td> </td>
<td> </td>
<td> </td>
</tr>
</tbody>
</table>
<p> </p>
<table style="height: 23px;" width="979">
<tbody>
<tr>
<td><img style="display: block; margin-left: auto; margin-right: auto;" src="http://www.questdesign.com.au/images/quest_design_folio_album_covers_subheader.png" alt="" /></td>
</tr>
</tbody>
</table>
<table style="height: 23px;" width="978">
<tbody>
<tr>
<td> </td>
<td> </td>
<td> </td>
<td><img style="display: block; margin-left: auto; margin-right: auto;" src="http://www.questdesign.com.au/images/headers/quest_design_earth_rhythm_album_cover.jpg" alt="" width="180" height="180" /></td>
<td><img style="display: block; margin-left: auto; margin-right: auto;" src="http://www.questdesign.com.au/images/headers/quest_design_glasgow_kiss_album_cover.jpg" alt="" width="180" height="180" /></td>
<td><img style="display: block; margin-left: auto; margin-right: auto;" src="http://www.questdesign.com.au/images/headers/quest_design_ironmonger_album_cover.jpg" alt="" width="180" height="180" /></td>
<td><img style="display: block; margin-left: auto; margin-right: auto;" src="http://www.questdesign.com.au/images/headers/quest_design_sarah_cooper_album_cover.jpg" alt="" width="180" height="180" /></td>
<td> </td>
<td> </td>
<td> </td>
</tr>
</tbody>
</table>
<p> </p>
<table style="height: 23px;" width="978">
<tbody>
<tr>
<td><img style="display: block; margin-left: auto; margin-right: auto;" src="http://www.questdesign.com.au/images/quest_design_folio_posters_banners_subheader.png" alt="" /></td>
</tr>
</tbody>
</table>
<table style="height: 23px;" width="978">
<tbody>
<tr>
<td> </td>
<td> </td>
<td> </td>
<td><img style="display: block; margin-left: auto; margin-right: auto;" src="http://www.questdesign.com.au/images/headers/quest_design_adam_quinn_music_promotional_poster.jpg" alt="" width="119" height="180" /></td>
<td><img style="display: block; margin-left: auto; margin-right: auto;" src="http://www.questdesign.com.au/images/headers/quest_design_bitten_by_productions_beyond_babylon_theatre_poster.jpg" alt="" width="127" height="180" /></td>
<td><img style="display: block; margin-left: auto; margin-right: auto;" src="http://www.questdesign.com.au/images/headers/quest_design_ironmonger_heavy_metal_music_promotional_poster.jpg" alt="" width="180" height="127" /></td>
<td><img style="display: block; margin-left: auto; margin-right: auto;" src="http://www.questdesign.com.au/images/headers/quest_design_mickyfit_training_boot_camp_fitness_poster.jpg" alt="" width="127" height="180" /></td>
<td> </td>
<td> </td>
<td> </td>
</tr>
</tbody>
</table>
<p> </p>
<table style="height: 23px;" width="977">
<tbody>
<tr>
<td><img style="display: block; margin-left: auto; margin-right: auto;" src="http://www.questdesign.com.au/images/quest_design_folio_stationary_subheader.png" alt="" /></td>
</tr>
</tbody>
</table>
<table style="height: 23px;" width="976">
<tbody>
<tr>
<td> </td>
<td> </td>
<td> </td>
<td><img style="display: block; margin-left: auto; margin-right: auto;" src="http://www.questdesign.com.au/images/headers/quest_design_emmerson_legal_stationery.jpg" alt="" width="180" height="98" /></td>
<td><img style="display: block; margin-left: auto; margin-right: auto;" src="http://www.questdesign.com.au/images/headers/quest_design_kate_brock_personal_trainer_letterhead_stationery.jpg" alt="" width="127" height="180" /></td>
<td><img style="display: block; margin-left: auto; margin-right: auto;" src="http://www.questdesign.com.au/images/headers/quest_design_kate_brock_personal_trainer_membership_card_stationery.jpg" alt="" width="180" height="102" /></td>
<td><img style="display: block; margin-left: auto; margin-right: auto;" src="http://www.questdesign.com.au/images/headers/rawgasm_stationary_example_quest_design.jpg" alt="" width="127" height="180" /></td>
<td> </td>
<td> </td>
<td> </td>
</tr>
</tbody>
</table>
<p> </p>
<p> </p>
<table>
<tbody>
<tr>
<td><img src="images/quest_design_folio_image_header.png" alt="" width="954" height="51" /></td>
</tr>
</tbody>
</table>
<table style="height: 23px;" width="983">
<tbody>
<tr>
<td><img style="display: block; margin-left: auto; margin-right: auto;" src="http://www.questdesign.com.au/images/quest_design_folio_retouching_subheader.png" alt="" /></td>
</tr>
</tbody>
</table>
<table style="height: 23px;" width="982">
<tbody>
<tr>
<td> </td>
<td> </td>
<td> </td>
<td><img style="display: block; margin-left: auto; margin-right: auto;" src="http://www.questdesign.com.au/images//headers/quest_design_luke_glamour_retouching.jpg" alt="" width="180" height="135" /></td>
<td><img style="display: block; margin-left: auto; margin-right: auto;" src="http://www.questdesign.com.au/images/headers/quest_design_matt_monica_glamour_retouching.jpg" alt="" width="180" height="117" /></td>
<td><img style="display: block; margin-left: auto; margin-right: auto;" src="http://www.questdesign.com.au/images/headers/quest_design_monica_glamour_retouching.jpg" alt="" width="180" height="105" /></td>
<td><img style="display: block; margin-left: auto; margin-right: auto;" src="http://www.questdesign.com.au/images/headers/quest_design_tegan_glamour_retouching.jpg" alt="" width="180" height="135" /></td>
<td> </td>
<td> </td>
<td> </td>
</tr>
</tbody>
</table>
<p> </p>
<table style="height: 23px;" width="981">
<tbody>
<tr>
<td><img style="display: block; margin-left: auto; margin-right: auto;" src="http://www.questdesign.com.au/images/quest_design_folio_restoration_subheader.png" alt="" /></td>
</tr>
</tbody>
</table>
<table style="height: 23px;" width="979">
<tbody>
<tr>
<td> </td>
<td> </td>
<td> </td>
<td><img style="display: block; margin-left: auto; margin-right: auto;" src="http://www.questdesign.com.au/images/headers/quest_design_family_image_restoration.jpg" alt="" width="125" height="180" /></td>
<td><img style="display: block; margin-left: auto; margin-right: auto;" src="http://www.questdesign.com.au/images/headers/quest_design_little_girl_image_restoration.jpg" alt="" width="180" height="131" /></td>
<td><img style="display: block; margin-left: auto; margin-right: auto;" src="http://www.questdesign.com.au/images/headers/quest_design_soldier_image_restoration.jpg" alt="" width="180" height="128" /></td>
<td><img style="display: block; margin-left: auto; margin-right: auto;" src="http://www.questdesign.com.au/images/headers/quest_design_toddler_image_restoration.jpg" alt="" width="180" height="56" /></td>
<td> </td>
<td> </td>
<td> </td>
</tr>
</tbody>
</table>
<p> </p>
<p> </p>
Any chance you can let me know what I might have missed out on. They show up centered on Mozilla firefox but in Chrome it aligns more to the right hand side.
You can change width: 982px; TO width="100%".
You can refer attached image.
If you want more details on what width: 100% do, you can refer this link :-
http://www.impressivewebs.com/width-100-percent-css/
It seems that Chrome is setting the width=985px, as per the attribute on the HTML element, whereas Safari (and Firefox) are respecting the max-width: 100% (960) value in the CSS. Remove that attribute to fix!
i have used on my site Width and height like
<table width="800px" height="600px" border="0" cellspacing="0" cellpadding="0" class="leftborder"/>
i have to changed this code media query for responsive but its not working i set background color red when i re size my browser its showing color only not in resize content
My code:
<style type="text/css">
#media only screen and (min-width: 320px) and (max-width : 780px)
{
.leftborder
{
background-color:skyblue;
}
.rightborder {
border-right: 1px solid #000000;
}
.leftborder {
border-left: 1px solid #000000;
border-right: 1px solid #000000;
border-bottom: 1px solid #000000;
border-style: thin;
}
.style2 {font-size: xx-small}
.descriptor_row
{
background:#003366;
font-size:x-small;
color:#FFFFFF;
border:#FFFFFF;
}
BODY { font-family: Arial, Helvetica, sans-serif;
line-height:160%;
font-size:14px;
color:#000;
background: url(images/gradient2.jpg);
background-repeat: repeat-x;
background-color:#FFF;
}
table.leftborder{
align:"right";
width:800px ! Important;
height:600px ! Important;
}
}
/* MOBILE LANDSCAPE */
#media only screen and (min-width: 480px) and (max-width: 780px)
{
.leftborder {
background-color:blue;
}
}
/* SMALL TABLET */
#media only screen and (min-width: 600px) and (max-width:780px)
{
.leftborder
{
background-color:green;
}
}
/* TABLET/NETBOOK */
#media only screen and (min-width: 768px) and (max-width: 780px)
{
.leftborder
{
background-color:yellow;
}
}
.rightborder {
border-right: 1px solid #000000;
}
.leftborder {
border-left: 1px solid #000000;
border-right: 1px solid #000000;
border-bottom: 1px solid #000000;
border-style: thin;
}
.style2 {font-size: xx-small}
.descriptor_row
{
background:#003366;
font-size:x-small;
color:#FFFFFF;
border:#FFFFFF;
}
BODY { font-family: Arial, Helvetica, sans-serif;
line-height:160%;
font-size:14px;
color:#000;
background: url(images/gradient2.jpg);
background-repeat: repeat-x;
background-color:#FFF;
}
</style>
<script type="text/javascript">
function openWindow(winName)
{
window.open(winName,"FAQs", "width=950,height=650,resizable=no,scrollbars=no,toolbar=no,status=no,menubar=no,copyhistory=no,left=100,top=100,screenX=100,location=no,screenY=100");
}
</script>
</head>
<link href="style.css" rel="stylesheet" type="text/css">
<body bgcolor="#FFFFFF" TOPMARGIN="0" LEFTMARGIN="0" RIGHTMARGIN="0">
<table width="100%" border="0" cellspacing="0" cellpadding="0" class="design"/ >
<tr>
<td align="center">
<table width="800px" height="600px" border="0" cellspacing="0" cellpadding="0" class="leftborder"/>
<tr bgcolor="#FFFFFF">
<td colspan="2" style="background-image:url('site_conf/images/det_banner.jpg'); background-repeat:no-repeat; background-position:center;" width="100%" height="100" align="right" />
<?php
if(!is_null($sid)&&$session_error=="none")
{
$_SESSION['lms_username']=$lms_username;
?><TABLE BORDER="0" CELLPADDING="2" CELLSPACING="0" WIDTH="190" >
<TR>
<TD><FONT FACE="VERDANA" SIZE="1" COLOR="#000000">Logged in as: <B><?php echo $lms_username; ?></B></TD>
</TR>
<?php
if($lms_groups=="on" && $lms_user_group!=""){
?>
<TR>
<TD><FONT FACE="VERDANA" SIZE="1" COLOR="#000000"><?php echo"$lms_gtitle: "; if($lms_groups=="on"){echo"<B>$lms_user_group</B>";}?></TD>
</TR>
<TR>
<TD><FONT FACE="VERDANA" SIZE="1" COLOR="#000000"><?php echo "$lms_sgtitle: "; if($lms_groups=="on"){echo"<B>$lms_user_subgroup</B>";}?></TD>
</TR>
<tr>
<TD><FONT FACE="VERDANA" SIZE="1" COLOR="#000000"><?php if($section=="reports" && $report){echo"<A HREF='index.php?section=reports&sid=$sid'>Back to Detailed Reports Section";}?></FONT></TD>
</tr>
<?php }?>
</TABLE>
<?php
}
?></td>
</tr>
<tr>
<td colspan="2" height="20" background="images/bg.gif">
<table width="100%" height="100%" border="0" cellspacing="0" cellpadding="0">
<tr>
<td> </td>
<TD align="right"><?php
if(!is_null($sid)&&$session_error=="none")
{
?><a style="" href="index.php?section=<?php echo $section; ?>&logout=YES&sid=<?php echo $sid; ?>"><img src="images/logout.gif" border="0" align="ABSMIDDLE" alt="Click here to Log Out"></a><?php
}
?></TD>
</tr>
</table></td>
</tr>
<tr>
<?php
if(is_null($sid)||$session_error!="none")
{
$nav_display = 'display: none';
}
?>
<td valign="top" style=" <?php echo $nav_display; ?> ">
<!---------BEGIN SIDE NAV TABLE------------->
<table width="198" border="0" cellspacing="0" cellpadding="0" >
<tr valign="top" bordercolor="#FFFFFF">
<td width="198" bordercolor="#FFFFFF"><?php
if((!is_null($sid)&&$session_error=="none"))
{
include($dir_components."navbar2.php");
}
?></td>
</tr>
<tr><td> </td></tr>
<tr>
<td></td>
</tr>
</table>
</td>
<td class="boxcontent" VALIGN="TOP" >
<?php
include($mysection);
?></td>
</tr>
</table>
</td>
</tr>
</table>
<hr width="200;">
</body>
</html>
added image what i am getting ?please help me any advise ?
On your media queries you have just changed the color and how do you supposed to get responsive design. You need to change other properties like width or height to adjust on that respective screen size. Or there are other options for you, like responsive tables plugins or if you want to fix via media queries you need to first decide how you wanna display on specific screen size, options are like scrollable tables or breaking table headings into blocks and columns below and so on then only you go to media queries to adjust as accordingly.
Well I have been at this for hours now. I'm using HTML2PDF to generate an invoice. My program creates a temporary invoice without issue. The issue I'm having is once the program tries to create a PDF from the temp file I'm getting an error:
ERROR n°5
File : /home/x/public_html/office/cron/invoices/php-pdf/_class/parsingHtml.class.php
Line : 218
HTML code invalid, all tags must be closed.
Status :
Array
(
[0] => page
[1] => table
[2] => tr
[3] => td
[4] => table
[5] => tr
[6] => td
)
I understand its saying all the HTML tags have not been closed. I've validated my code many different times, many different ways and sites and all are returning valid. I had some style issues that have been fixed but I still have no luck. My html is as follows:
<!doctype html>
<html>
<head>
<title>Untitled Document</title>
<style>
<!--
body {font-family:Gotham, "Helvetica Neue", Helvetica, Arial, sans-serif;}
.center {text-align:center;}
.ltgray {color:#C5C5C5;}
.invoice {vertical-align:text-top;}
.gbk td {background-color:#EDEBEB; border:none; font-size:13px; padding-bottom:8px; padding-top:8px; padding-left:10px}
.btboader { border-bottom:thin dotted; border-color:#E4E2E2; padding-bottom:8px; padding-top:8px; padding-left:10px }
.ltgrayt {color:#969696;}
.center {align-content:center; font-size:12px; font-weight:bold;}
.db {border:thin dotted; background-color:#EDEBEB;}
.padded {padding-left:15px;}
.hr { border: 0; height: 1px; background-image: -webkit-linear-gradient(left, rgba(0,0,0,0), rgba(0,0,0,0.75), rgba(0,0,0,0)); background-image: -moz-linear-gradient(left, rgba(0,0,0,0), rgba(0,0,0,0.75), rgba(0,0,0,0)); background-image: -ms-linear-gradient(left, rgba(0,0,0,0), rgba(0,0,0,0.75), rgba(0,0,0,0)); background-image: -o-linear-gradient(left, rgba(0,0,0,0), rgba(0,0,0,0.75), rgba(0,0,0,0)); }
-->
</style>
</head>
<body>
<table style="width: 100%">
<tr>
<td class="invoice"><h2 class="ltgray">Invoice</h2> </td>
<td style="float: right">
<table>
<tr>
<td>Date:</td> <td> 03/12/2015</td>
</tr>
<tr>
<td>Invoice #:</td> <td> 100367</td>
</tr>
<tr>
<td> Propery </td> <td> N/a </td>
</tr>
</table>
</td>
</tr>
</table>
<p></p>
<table style="width: 95%; margin: 0 auto;">
<tr>
<td style="width: 50%"><span class="ltgray">Company Information</span><br />
<strong>XXX</strong><br />XXXX<br />XXXX</td>
<td style="width: 50%"><span class="ltgray">Customer Information</span><br />
<strong>XXXX</strong><br />XXXX<br />
XXXX<br />XXXX<br />Phone: XXXX<br />Email: XXXX</td>
</tr>
</table>
<br /><p></p>
<table style="width: 100%" class="tbl">
<tr class="gbk">
<td style="width: 60%"><strong>Item</strong></td>
<td style="width: 15%"><strong>Price</strong></td>
<td style="width: 10%"><strong>Qty</strong></td>
<td style="width: 15%; margin: 0 auto;"> <strong>Total</strong> </td>
</tr>
<tr>
<td style="width: 60%" class="btboader">Mulch - Red</td>
<td style="width: 15%" class="btboader">$2.50</td>
<td style="width: 10%" class="btboader">153</td>
<td style="width: 15%; margin: 0 auto;" class="btboader">$382.50</td>
</tr>
<tr>
<td style="width: 60%" class="btboader">Mulch - Black</td>
<td style="width: 15%" class="btboader">$3.50</td>
<td style="width: 10%" class="btboader">1</td>
<td style="width: 15%; margin: 0 auto;" class="btboader">$3.50</td>
</tr>
<tr>
<td style="width: 60%" class="btboader">Mulch - Brown<br><small>Bagged mulch, price includes delivery - Total 2 1/2 pallets</small> </td>
<td style="width: 15%" class="btboader">$3.50</td>
<td style="width: 10%" class="btboader">160</td>
<td style="width: 15%; margin: 0 auto;" class="btboader">$560.00</td>
</tr>
<tr>
<td colspan="2">
<table style="width: 100%">
<tr>
<td style="width: 20%">Payment Terms:</td>
<td style="width: 80%">Due On Receipt</td>
</tr>
<tr>
<td style="width: 50%">Discount(%):</td>
<td style="width: 50%">10.0</td>
</tr>
<tr>
<td style="width: 50%">Past Due Amount:</td>
<td style="width: 50%">$0.00</td>
</tr>
</table>
</td>
<td colspan="2">
<table style="width: 100%">
<tr>
<td style="width: 50%" class="ltgrayt">Subtotal:</td>
<td style="width: 50%; float: right;">$946.00</td>
</tr>
<tr>
<td style="width: 50%" class="ltgrayt">Tax (6.5%):</td>
<td style="width: 50%; float: right;"> $0.00</td>
</tr>
<tr>
<td style="width: 50%" class="ltgrayt">Discount:</td>
<td style="width: 50%; float: right;"> $94.60</td>
</tr>
<tr>
<td style="width: 50%" class="ltgrayt">Past Due:</td>
<td style="width: 50%; float: right;"><strong> $0.00 </strong></td>
</tr>
<tr>
<td style="width: 50%" class="ltgrayt">Total:</td>
<td style="width: 50%; float: right;"><strong> $851.40 </strong></td>
</tr>
</table>
</td>
</tr>
</table>
<br /><br />
<table class="db" style="width: 80%; margin: 0 auto;">
<tr>
<td><strong class="padded"><small>Order Notes:</small></strong><br /><p class="padded">Thank you for your business!</p>
</td>
</tr>
</table>
<hr class="hr">
<p class="center">XXXX, XXXX, XXXX - Phone: XXXX - Direct Cell: XXXX Email:XXXX<br />
Please make checks payable to: XXXX</p>
</body>
</html>
What am I missing that's causing this error? The only other thing I could think of is that HTML2PDF doesn't support something in my styling. I use HTML2PDF for another project without issue so Im not sure where I made a wrong turn.