Converting a HTML table full of images to look decent on mobile - html

I have a HTML table that's completely composed of eight images. They're puzzle pieces, so they have to be placed specifically and accurately.
This was easy on desktop, I just used absolute positioning to mess around with the pixels and make it work. It looks like trash on mobile though. The pieces are still together, but the puzzle is all the way to the right of the screen and it's too large. I've done a fair bit of Googling, but the only results I found were for tables composed of text, which doesn't work for my situation.
Here's the table, if anyone's interested -
<table width="100%" id="table" border="0" cellpadding="0" cellspacing="5" align="center">
<tr>
<td id="one">
<img src="1.png" class="merge0">
</td>
<td id="two">
<img id="2" src="6.png" class="merge">
</td>
<td>
</td>
</tr>
<tr>
<td id="three">
<img src="4.png" class="row1">
</td>
<td id="four">
<img src="2.png" class="merge1">
</td>
<td id="five">
<img src="7.png" class="merge2">
</td>
</tr>
<tr>
<td id="six">
<img src="8.png" class="row2">
</td>
<td id="seven">
<img src="5.png" class="row3">
</td>
<td id="eight">
<img src="3.png" class="row4">
</td>
</tr>
</table>
I read a bit about jQuery mobile, but I've never really grasped the concept of jQuery, and mobile is a foreign platform to me. I'm hoping to learn though :)
I've also tried those "desktop to mobile" converters, and they all are horrible.
Edit - I think people might suggest that I completely take the table out and use a different method of arranging my images. I'm really not sure how to go about doing this, and I'd prefer it if I could keep my current setup. If it's not possible though, I'd appreciate some pointers on how to do it differently.

Go over the getting started page and then use jQuery-mobile grids:
<div class="ui-grid-a">
<div class="ui-block-a"><img src="1.png" class="merge0"></div>
<div class="ui-block-b"><img id="2" src="6.png" class="merge"></div>
</div>
For the grid with three images just use "ui-grid-b"
Hope this helps
best
M

Related

How to Overlay Text on Image Using HTML with no CSS?

I wanted to have a full-width call-to-action banner on my client's website. The template that my client has does not support CSS, so I'm making use of like old school HTML to build pages.
I have a background image for the img src and I want to overlay the text in it. I'm in need of a code that is working since I'm really not well-versed.
I searched up for solutions in adding overlay text to a background image, but most of the answers contain CSS. Here's a code that I tried.
<table>
<tr>
<td></td>
<td rowspan=4><img src="/uploads/image12345jpg"></td>
</tr>
<tr>
<center><td colspan=4>This is the overlay text</td></center>
</tr>
</table>
</center>
I'd appreciate your help and answers.
The support says that I have to individually add it in the HTML code... not sure where it goes.
I think you might be looking for something like this: https://jsfiddle.net/DIRTY_SMITH/vz04m3ph/2/
<TABLE border="0" cellpadding="0" cellspacing="0">
<TR>
<TD width="221" height="300" background="https://placeimg.com/640/480/any" valign="bottom">
<FONT size="+1" COLOR="red">This is the overlay text</FONT>
</TD>
</TR>
</TABLE>
EDIT:
This question is asking how to use inline styles, I think:
(I've also put some inline javascript on a click function because you mentioned your scripts wernt working either)
https://jsfiddle.net/DIRTY_SMITH/vz04m3ph/28/
<td style="position:relative;">
<img src="https://placeimg.com/640/480/any" style="position:absolute;z-index:1;" width="600px" height="150px" />
<div style="z-index:2;position:relative;color:red;font-weight:bold; font-size: 40px; top: 40px; left: 100px;" onClick="(function(){
alert('See You can click me');
return false;
});">
<a href="#" onClick="(function(){ alert('See You can click me'); return false; })();return false;">
your text goes here click here</a>
</div>
</td>
This worked for me. Thank you for the help! Appreciate it.
<div class="container" style="position:relative;text-align:center;color:white;" >
<img class="img-responsive" src="https://placeimg.com/640/480/any" alt="#" style="width:1880px;height:250px;" >
<div class="centered" style="position:absolute;top:50%;left:50%;transform:translate(-50%, -50%);" >Example Text</div>
</div>

Why does my HTML table shrink images from left to right?

I made a simple HTML table, filled it with placeholder images, and spaced them with a background color. This is what I get:
Compare the rightmost image to the left... then notice how each image gets smaller. Very odd.
td {
padding: 5px;
background-color: #C6C6C6;
}
<table>
<tr>
<td>
<img src="http://www.examplesite.com/pholder.png" />
</td>
<td style="background-color: #FFFFFF;"></td>
<td>
<img src="http://www.examplesite.com/pholder.png" />
</td>
<td style="background-color: #FFFFFF;"></td>
<td>
<img src="http://www.examplesite.com/pholder.png" />
</td>
<td style="background-color: #FFFFFF;"></td>
<td>
<img src="http://www.examplesite.com/pholder.png" />
</td>
<td style="background-color: #FFFFFF;"></td>
<td>
<img src="http://www.examplesite.com/pholder.png" />
</td>
</tr>
</table>
As you can see, I space the table with a margin and empty columns. I think that may be the cause, but I'm not sure why or how to fix it while keeping the neat visual appearance. How do I fix this?
Note: The site is also mobile-responsive and has to scale images automatically, so setting a fixed width/height will not work for me.
I do not have a good answer to your exact question but I can tell you using a table for layout is a very bad practice especially if you want to make the site responsive. Tables are for tabular data display.
Using divs and css with media queries will assure that your layout is consistent. Sure it will take a bit more but there is a lot of good material out there on how to do it.
====EDIT ====
To fix the issue at hand as well you can add a width to the td. It will keep them the same size if you know how many elements will be displayed. In the current table you have 5 so
<tr>
<td width="20%">image</td>
<td width="20%">image</td>
<td width="20%">image</td>
<td width="20%">image</td>
<td width="20%">image</td>
</tr>
Tables try and space things depending on the content. It leads to the end cells getting squished.

Table pictures alignment issue

For the first time I am posting here cause if usually I am able to find a solution to my code issues throughout other answers, this time, no matter what I try, it doesn't work.
I am doing a table with two rows with basically pictures on the first row linking some PDF docs with a title below (second row).
The thing is that pictures do not have the same size (that can't be change). I would like them to be align on the bottom of the row, with a small margin before the separation line.
Right now, they are centered (by default I guess) which is not bad but not what I want anyway.
The second issue that I have while they are centered is that the first picture of of the row is always a bit higher than the rest for some reason. Can't figure out why.
Hopefully you can help me with the code written below (I assume that its full of mistakes since several calls doesn't work and could probably be removed).
<table width="780"; bgcolor="#e8e8e8" style="table-layout:fixed" VALIGN="top">
<tr>
<td style="word-wrap: break-word;"; ALIGN="CENTER">
<div align="center";>
<a href="PDF URL" target="_blank">
<img src="URL" alt="ALT">
</a>
</div>
</td>
<td>
<div align="center">
<a href="PDF URL" target="_blank">
<img src="URL" alt="ALT">
</a>
</div>
</td>
<td>
<div align="center">
<a href="PDF URL" target="_blank">
<img src="URL" alt="ALT">
</a>
</div>
</td>
</tr>
<tr>
<td><div align="center"><p style="font-size:11px"><a title="TITLE1" href="URL" target="_blank">TITLE1</p></a>
</div></td>
<td><div align="center"><p style="font-size:11px"><a title="TITLE2" href="URL" target="_blank">TITLE2</p></a>
</div></td>
<td><div align="center"><p style="font-size:11px"><a title="TITLE3" href="URL" target="_blank">TITLE3</p></a>
</div></td>
<td><div align="center"><p style="font-size:11px"><a title="TITLE4" href="URL" target="_blank">TITLE4</p></a>
</div></td>
{/tr}
{/table}
You should first include a .css file call in your header like this:
<head>
<link rel="stylesheet" type="text/css" href="mystyle.css">
</head>
Then u can create a "mystyle.css" file in order to apply all the styles you want for your table.
Take a look at this page. W3School - CSS
There u have some examples about how to change color, margin, background images and so on.
EDIT:
If you want o apply all the styles in the .html file try looking at this web. http://www.w3schools.com/tags/
There u have all html tags, select the one u want and see the attributes could use.

image align to cell bottom

I have this html
<style type="text/css">
#DownloadLeaflet {
bottom: 0px;
}
</style>
<table style="width:97%" summary="">
<tbody>
<tr>
<td style="width:100px" width="118">
<img style="border-bottom:0px solid;border-left:0px solid;border-top:0px solid;border-right:0px solid" src="http://www.banqueaudi.com/RetailBanking/PublishingImages/2008/adsl.png" border="0">
</td>
<td style="width:100%" width="776">
<div style="height:52px">
<span class="title">ADSL Service</span><br>
<em class="Slogan">Be Fast Ahead with Our ADSL Service</em>
</div>
<p>
The new high-speed ADSL connection is now available with privileged conditions
</p>
<p>
Everybody is getting connected, what are you waiting for? Guarantee your peace of mind in a simple 1-step procedure with a reliable internet service from a trusted source.
</p>
<p>
you will gain the communication edge with a high-performance internet connection at an efficient cost.
</p>
<img id="DownloadLeaflet" style="border-bottom:0px solid;border-left:0px solid;border-top:0px solid;border-right:0px solid" src="http://www.banqueaudi.com/PublishingImages/Shared/DownloadLeaflet.png" border="0">
</td>
</tr>
</tbody>
</table>
I have tried everything possible with css , but it seems im not a CSS fan
I want to align the download button to the bottom of the cell, see this fiddle.
you have to give table relative and image absolute and bottom:0
http://jsfiddle.net/JfZZD/44/
check the fiddle

How can I position absolutely a div in a table?

I'm trying to correct an old template which contains tables and not divs.
The whole template consists of tables.
I'm tyring to position an png image absolutely in the table, that is overlapping the background.
The code I've made is as follows:
<tr>
<td></td>
<td><a href="homepage.html">
<div style="position:absolute;margin-top:-60px;margin-left:-18px;">
<img src="images/header.png" width="280" height="120" alt="" border="0">
</div>
</a>
</td>
</tr>
The problem is that some browsers "miss" a pixel.
Is there any way to position absolutely an image in a table?
p.s. at the moment, I know that the best way is to use divs, but I shall not alter the whole template, just alter only the heading.
Correct way:
<tr>
<td></td>
<td>
<div style="position:absolute;margin-top:-60px;margin-left:-18px;">
<a href="homepage.html">
<img src="images/header.png" width="280" height="120" alt="" border="0">
</a>
</div>
</td>
</tr>