Responsive two-column in mobile html - html

I'm trying to set two images in two column in mobile but doesn't work any idea?
Demo here
HTML
<table bgcolor="#ffffff" id="event-info" class="outer-table"
summary="outer-table" valign="top" border="0" cellpadding="0" cellspacing="0" style="background-color:#ffffff; width:100%; max-width:600px; Margin:0 auto" width="100%">
<tr align="center" class="tab1">
<td>
<img src="images/website.png" class="features" border="0" width="600" style="width:30%;max-width:600px;">
<p class="features" border="0" width="600" style="width:35%;max-width:600px;
font-size: 12px;padding-top: 10px;font-weight: 700;">Website</p>
</td>
<td>
<img src="images/mobile.png" class="features" border="0" width="600" style="width:30%;max-width:600px;">
<p class="features" border="0" width="600" style="width:35%;max-width:600px;
font-size: 12px;padding-top: 10px;font-weight: 700;">Mobile</p>
</td>
<td>
<img src="images/marketing.png" class="features" border="0" width="600" style="width:30%;max-width:600px;">
<p class="features" border="0" width="600" style="width:35%;max-width:600px;
font-size: 12px;padding-top: 10px;font-weight: 700;">Marketing</p>
</td>
</tr>
<tr align="center" class="tab2">
<td>
<img src="images/support.png" class="features" border="0" width="600" style="width:30%;max-width:600px;">
<p class="features" border="0" width="600" style="width:35%;max-width:600px;
font-size: 12px;padding-top: 10px;font-weight: 700;">Support</p>
</td>
<td>
<img src="images/management.png" class="features" border="0" width="600" style="width:30%;max-width:600px;">
<p class="features" border="0" width="600" style="width:35%;max-width:600px;
font-size: 12px;padding-top: 10px;font-weight: 700;">Management</p>
</td>
<td>
<img src="images/customer.png" class="features" border="0" width="600" style="width:30%;max-width:600px;">
<p class="features" border="0" width="600" style="width:35%;max-width:600px;
font-size: 12px;padding-top: 10px;font-weight: 700;">Customer</p>
</td>
<tr class="spacer-40" height="40" style="height:55px; padding: 0 !important; margin: 0 !important; font-size: 0 !important; line-height: 0 !important;">
<td> </td>
</tr>
</tr>
</table>
CSS
#media only screen and (max-width: 769px){
table tr td{
display:block;
}
}

Update based on comment
Since you can't switch a table from a 3 column to a 2 column layout (at least not in a proper way) and half of the email clients doesn't support media queries, I came up with this solution.
Test it thoroughly with email clients as I haven't been able to do that
I added min-width: 100px; to the "tabs" divs which will make it break into 1 column when lack of space. Remove it if you don't want that.
<div style="max-width:600px;margin:0 auto;text-align: center;">
<div style="display:inline-block;text-align:center;width:calc(100% - 4px);max-width:150px;min-width: 100px;">
<img src="images/website.png" style="border:0;width:30%;">
<p style="font-size:12px;padding-top:10px;font-weight:bold;text-align:center;">Website</p>
</div>
<div style="display:inline-block;text-align:center;width:calc(100% - 4px);max-width:150px;min-width: 100px;">
<img src="images/website.png" style="border:0;width:30%;">
<p style="font-size:12px;padding-top:10px;font-weight:bold;text-align:center;">Website</p>
</div>
<div style="display:inline-block;text-align:center;width:calc(100% - 4px);max-width:150px;min-width: 100px;">
<img src="images/website.png" style="border:0;width:30%;">
<p style="font-size:12px;padding-top:10px;font-weight:bold;text-align:center;">Website</p>
</div>
<div style="display:inline-block;text-align:center;width:calc(100% - 4px);max-width:150px;min-width: 100px;">
<img src="images/website.png" style="border:0;width:30%;">
<p style="font-size:12px;padding-top:10px;font-weight:bold;text-align:center;">Website</p>
</div>
<div style="display:inline-block;text-align:center;width:calc(100% - 4px);max-width:150px;min-width: 100px;">
<img src="images/website.png" style="border:0;width:30%;">
<p style="font-size:12px;padding-top:10px;font-weight:bold;text-align:center;">Website</p>
</div>
<div style="display:inline-block;text-align:center;width:calc(100% - 4px);max-width:150px;min-width: 100px;">
<img src="images/website.png" style="border:0;width:30%;">
<p style="font-size:12px;padding-top:10px;font-weight:bold;text-align:center;">Website</p>
</div>
</div>
As that can't be done properly using table, here is a flex solution.
.outer {
max-width:600px;
margin:0 auto;
display: flex;
flex-wrap: wrap;
}
.outer .tab1 {
width: 33%;
text-align: center;
}
.outer img.features {
border:0;
width:30%;
max-width:600px;
}
.outer p.features {
max-width:600px;
font-size: 12px;
padding-top: 10px;
font-weight: 700;
text-align: center;
}
#media only screen and (max-width: 480px){
.outer .tab1 {
width: 50%;
}
}
<div id="event-info" class="outer">
<div class="tab1">
<img src="images/website.png" class="features">
<p class="features">Website</p>
</div>
<div class="tab1">
<img src="images/website.png" class="features">
<p class="features">Website</p>
</div>
<div class="tab1">
<img src="images/website.png" class="features">
<p class="features">Website</p>
</div>
<div class="tab1">
<img src="images/website.png" class="features">
<p class="features">Website</p>
</div>
<div class="tab1">
<img src="images/website.png" class="features">
<p class="features">Website</p>
</div>
<div class="tab1">
<img src="images/website.png" class="features">
<p class="features">Website</p>
</div>
</div>
If flex can't be used, use display: inline-block
.outer {
max-width:600px;
margin:0 auto;
}
.outer .tab1 {
display: inline-block;
text-align: center;
width: calc(33% - 4px); /* 4px, see comment below */
}
.outer img.features {
border:0;
width:30%;
max-width:600px;
}
.outer p.features {
max-width:600px;
font-size: 12px;
padding-top: 10px;
font-weight: 700;
text-align: center;
}
#media only screen and (max-width: 480px){
.outer .tab1 {
width: calc(50% - 4px);
}
}
<div id="event-info" class="outer">
<div class="tab1">
<img src="images/website.png" class="features">
<p class="features">Website</p>
</div>
<div class="tab1">
<img src="images/website.png" class="features">
<p class="features">Website</p>
</div>
<div class="tab1">
<img src="images/website.png" class="features">
<p class="features">Website</p>
</div>
<div class="tab1">
<img src="images/website.png" class="features">
<p class="features">Website</p>
</div>
<div class="tab1">
<img src="images/website.png" class="features">
<p class="features">Website</p>
</div>
<div class="tab1">
<img src="images/website.png" class="features">
<p class="features">Website</p>
</div>
</div>
Side note:
The 4px used, is to compensate for the white space (the line break between elements in the markup) and is based on font size, so if it increases this value might need to be adjusted.
An alternative is to change the markup from
</div>
<div class="tab1">
to
</div><div class="tab1">
or
</div><!--
--><div class="tab1">

Related

How to make responsive signature mail

I got problem with my email signature. It's not quite responsive. Responsive just for window resize but not for tool's developer chrome
here's files from dropbox
www.dropbox.com/sh/z09rlwphzdbzq5c/AABZu1NZCPZ_EEFOUzeAX3JZa?dl=0
.background{
background: url("https://image.ibb.co/cse3Jb/bg_car.png") center no-repeat;
}
div[class="wide-version-of-table"] { display:block; }
div[class="narrow-version-of-table"] { display:none; }
body { padding:0 !important; margin:0 !important; display:block !important; width:100% !important; background:#ffffff; -webkit-text-size-adjust:none }
#media only screen and (max-device-width: 500px), only screen and (max-width:500px) /* The maximum width for the mobile device version. */
{
div[class="wide-version-of-table"] { display:none; }
div[class="narrow-version-of-table"] { display:block; }
span[class='content-width-img'] img { width: 100% !important; height: auto !important; max-width: 480px !important; }
}
#media only screen and (max-device-width: 800px), only screen and (max-width: 800px) {
table[class='w320'] {
width: 100% !important;
}
th[class='column'] { float: left !important; width: 100% !important; display: block !important; }
}
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=iso-8859-2">
<title>CarSPA Email</title>
</head>
<body class="body" style="padding:0 !important; margin:0 !important; display:block !important; width:100% !important; background:#ffffff; -webkit-text-size-adjust:none">
<div class="wide-version-of-table">
<table width="100%" border="0" cellspacing="0" cellpadding="0">
<tr>
<th valign="top" align="center">
<table width="800" border="0" cellspacing="0" cellpadding="0" class="w320">
<tr>
<th>
<div >
<table cellpadding="0" cellspacing="0" border="0" style="font-size:12px; font-family: Arial; line-height: 17px;background: url(bg-car.png) right no-repeat;" width="100%">
<tr>
<td class="column">
<img src="https://image.ibb.co/cosCBw/zdjecie_01.png" style="padding-left: 5px;" alt="CarSPA - Właściciel"/>
</td>
<td class="column" width="90%" valign="top" style="padding-top: 30px;padding-bottom: 10px;padding-left: 20px;">
<p style="font-size:15px; font-weight: bold; color:#454545; margin: 0px; margin-bottom: 10px;">
Karol Nowak<br/>
<span style="font-weight: normal;">właściciel</span></p>
<p style="padding-top: 12px;font-size:15px;"><span style="font-weight: bold">cars warsaw</span><br/>
tel.kom. +48 555 555 555<br/>
email: emailadres<br/>
</p>
<p style="padding-top: 12px;font-size:15px;">
ul. Frontzka 2<br/>
77-577 Poland
</p>
</td>
<td class="column"align="right" style="position: relative; padding-right: 5px;">
<!--<img src="bg-car.png" alt="CarSpa - email"/>-->
<span><img src="https://image.ibb.co/cNkcdb/carspa_logo.png" alt="CarSpa - logo" style="margin-bottom: 13px;margin-top: 25px;"/>
</span>
<span><img src="https://image.ibb.co/jD0XBw/icon_fb.png" alt="CarSpa - Facebook" style=""/>
</span>
<span><img src="https://image.ibb.co/jD0XBw/icon_fb.png" alt="CarSpa - Instagram" style="padding: 0px 10px;"/>
</span>
<span><img src="https://image.ibb.co/jD0XBw/icon_fb.png" alt="CarSpa - Youtube" style="padding-right: 0px"/>
</span>
</td>
</tr>
</table>
</div>
</th>
</tr>
</table>
</th>
</tr>
</table>
</div>
<div class="narrow-version-of-table">
<table width="100%" border="0" cellspacing="0" cellpadding="0">
<tr>
<th valign="top" align="center">
<table width="800" border="0" cellspacing="0" cellpadding="0" class="w320">
<tr>
<th>
<div >
<table cellpadding="0" cellspacing="0" border="0" style="font-size:12px; font-family: Arial; line-height: 17px;background: url(bg-car.png) right no-repeat;" width="100%">
<tr>
<td class="column">
<img src="zdjecie-01.png" style="padding-left: 5px;" alt="CarSPA - Właściciel"/>
</td>
<td class="column" width="90%" valign="top" style="padding-top: 30px;padding-bottom: 10px;padding-left: 20px;">
<p style="font-size:15px; font-weight: bold; color:#454545; margin: 0px; margin-bottom: 10px;">
Piotr Zawisza<br/>
<span style="font-weight: normal;">właściciel</span></p>
<p style="padding-top: 12px;font-size:15px;"><span style="font-weight: bold">CarSPA Gdynia</span><br/>
tel.kom. +48 505 505 999<br/>
email: piotr.zawisza#car-spa.pl<br/>
</p>
<p style="padding-top: 12px;font-size:15px;">
ul. Stryjska 11<br/>
81-507 Gdynia
</p>
</td>
</tr>
<tr>
<td class="column"align="right" style="position: relative;">
<!--<img src="bg-car.png" alt="CarSpa - email"/>-->
<span style="margin-left: 100%;">
<a href=""><img src="carspa-logo.png" alt="CarSpa - Logo" style="margin-bottom: 13px;margin-top: 25px;"/>
</a>
<span style="margin-left: 100%">
<img src="icon-fb.png" alt="CarSpa - Facebook" style=""/>
<img src="icon-ig.png" alt="CarSpa - Instagram" style="padding: 0px 10px;"/>
<img src="icon-yt.png" alt="CarSpa - Youtube" style="padding-right: 0px"/>
</span>
</span>
</td>
</tr>
</table>
</div>
</th>
</tr>
</table>
</th>
</tr>
</table>
</div>
</body>
</html>
https://codepen.io/zaraki12345/pen/RxOoZe
#media screen and (max-width: 768px), screen and (max-device-width: 768px) {
table[class="responsive_table"] {
width:100% !important;
}
table[class="responsive_table"] td {
height: auto !important;
}
table[id="emailContainer"] {
max-width: 600px !important;
width: 95% !important;
}
}
<table border="0" cellpadding="0" cellspacing="0" height="100%" width="100%" id="bodyTable">
<tr>
<td align="center" valign="top">
<table cellpadding="0" cellspacing="0" width="650" id="emailContainer">
<tr>
<td align="center" valign="top">
<table cellpadding="0" cellspacing="0" width="100%" class="emasilBody">
<tr>
<td align="center">
<table cellpadding="0" cellspacing="0" width="200" class="responsiveTable" align="left">
<tr>
<td align="center">
<img src="https://image.ibb.co/cosCBw/zdjecie_01.png" style="padding-left: 5px;" alt="CarSPA - Właściciel"/>
</td>
</tr>
</table>
<table cellpadding="0" cellspacing="0" width="200" class="responsiveTable" align="left">
<tr>
<td align="center">
<p style="font-size:15px; font-weight: bold; color:#454545; margin: 0px; margin-bottom: 10px;">Karol Nowak<br/><span style="font-weight:normal;">właściciel</span></p>
<p style="padding-top: 12px;font-size:15px;"><span style="font-weight: bold">cars warsaw</span><br/>tel.kom. +48 555 555 555<br/> email: emailadres</p>
<p style="padding-top: 12px;font-size:15px;">ul. Frontzka 2<br/>77-577 Poland</p>
</td>
</tr>
</table>
<table cellpadding="0" cellspacing="0" width="200" class="responsiveTable" align="left">
<tr>
<td align="center">
<p style="margin-top:0;"><img src="https://image.ibb.co/cNkcdb/carspa_logo.png" alt="CarSpa - logo" style="margin-bottom: 13px;"/>
</p>
<p><img src="https://image.ibb.co/jD0XBw/icon_fb.png" alt="CarSpa - Facebook" /><img src="https://image.ibb.co/jD0XBw/icon_fb.png" alt="CarSpa - Instagram" style="padding: 0px 10px;"/><img src="https://image.ibb.co/jD0XBw/icon_fb.png" alt="CarSpa - Instagram" style="padding: 0px 10px;"/>
</p>
</td>
</tr>
</table>
</td>
</tr>
</table>
</td>
</tr>
</table>
</td>
</tr>
</table>

Replacing an html table with a div tag

I have an html table on my website (emma-moore.com) that I'm using for layout instead of tabular data:
<table border="0" cellpadding="5px" width="100%" class="followFont">
<tbody>
<tr>
<td align="left">Follow your heart</td>
</tr>
<tr>
<td align="left" style="padding-bottom: 10px">and you'll always</td>
</tr>
<tr>
<td align="left">
<img border="0" src="balloonsAndLavenderFields.jpg" width="99px" height="150px" class="homePictureFrame" />
</td>
</tr>
<tr>
<td align="left" style="padding-top: 10px">end up where your</td>
</tr>
<tr>
<td align="left">soul needs to be.</td>
</tr>
</tbody>
</table>
Best practice is not to use inline styles and tables for layout, and I'm wondering how to replace the table with a div block and put the text and the jpg inside the div block in such a way that the text and jpg display the same way as they do when using the table. How can I best do this with css and a div block?
Thanks,
William
.followFont
{
padding:5px;
border:0;
cellpadding:5px;
width:100%;
display:table;
}
<div class="followFont">
<div style="display:table-row;">
<div style="width:100%; display:table-cell; text-align:left;">Follow your heart</div>
</div>
<div style="display:table-row;">
<div style="width:100%; display:table-cell; text-align:left; padding-bottom: 10px;">and you'll always</div>
</div>
<div style="display:table-row;">
<div style="width:100%; display:table-cell; text-align:left;">
<img border="0" src="balloonsAndLavenderFields.jpg" width="99px" height="150px" class="homePictureFrame" />
</div>
</div>
<div style="display:table-row;">
<div style="width:100%; display:table-cell; text-align:left; padding-top: 10px;">end up where your</div>
</div>
<div style="display:table-row;">
<div style="width:100%; display:table-cell; text-align:left;">
soul needs to be.
</div>
</div>
</div>
Link:-https://html-cleaner.com/features/replace-html-table-tags-with-divs/
<h2>Phone numbers</h2>
<table width="300" border="1" cellpadding="5" style="text-align: center">
<tr>
<th width="75"><strong>Name</strong></th>
<th><span style="font-weight: bold;">Telephone</span></th>
<th> </th>
</tr>
<tr>
<td>John</td>
<td>0123 456 785</td>
<td><img src="images/check.gif" alt="checked" /></td>
</tr>
<tr>
<td>Cassie</td>
<td>9876 532 432</td>
<td><img src="images/check.gif" alt="checked" /></td>
</tr>
</table>
<h2>Phone numbers</h2>
<div class="rTable">
<div class="rTableRow">
<div class="rTableHead"><strong>Name</strong></div>
<div class="rTableHead"><span style="font-weight: bold;">Telephone</span></div>
<div class="rTableHead"> </div>
</div>
<div class="rTableRow">
<div class="rTableCell">John</div>
<div class="rTableCell">0123 456 785</div>
<div class="rTableCell"><img src="images/check.gif" alt="checked" /></div>
</div>
<div class="rTableRow">
<div class="rTableCell">Cassie</div>
<div class="rTableCell">9876 532 432</div>
<div class="rTableCell"><img src="images/check.gif" alt="checked" /></div>
</div>
</div>
You can use
<div id="table" style="display: table;">
<div class="cell" id="cell1"></div>
<div class="cell" id="cell2"></div>
<div class="cell" id="cell3"></div>
</div>
You'll be using like table
Div can have the same properties as table
like
#table
{
vertical-align:middle;
text-align:center:
border:solid 1px #ddd;
width:100%;
}
.cell
{
display:table-cell;
vertical-align:middle;
text-align:center;
border:solid 1px #ddd;
width:25%;
padding:10px;
}
and soon....
Hope this helps

Image table that maintains aspect ratio of images

I currently have a table setup that holds images in a table of varying sizes and is able to resize the image accordingly. How can I make the image maintain aspect ratio?
/* THIS PART IS FOR PAGE SETUP*/
.page-wrap {
min-height: 100%;
/* equal to footer height */
}
.page-wrap:after {
content: "";
display: block;
}
.site-footer,
.page-wrap:after {
margin: 0;
margin-top: 100px;
}
.site-footer {
border-top: 2px dashed #95a0b7;
margin-left: auto;
margin-right: auto;
}
/* this is styling! */
.post {
color: #843900;
font-family: Calibri;
font-size: 112%;
border: 2px solid #;
padding-left: 10px;
padding-top: 5px;
padding-bottom: 5px;
margin-left: 10;
}
html,
body {
background-color: #d1d6e0;
height: 100%;
}
/* THIS STUFF IS FOR DESIGN */
table {
width: 100%;
height: 100%;
}
td {
padding-left: 10px;
padding-bottom: 10px;
}
th {
text-align;
left;
}
.postTableBorder {
border-bottom: 1px dashed #95a0b7;
}
.footer {
text-align: center;
color: #843900;
font-family: Calibri;
font-size: 112%;
padding-bottom: 10px;
font-weight: bold;
}
h1 {
color: #843900;
font-family: Calibri;
font-size: 500%;
text-align: center;
margin: 0;
border-bottom: 5px dotted #95a0b7;
}
a {
text-decoration: none;
color: #843900;
text-shadow: 1px 1px 2px #662c00;
}
a:hover {
color: #662c00;
}
.headerP {
font-weight: bold;
color: #843900;
font-family: Calibri;
font-size: 150%;
}
.headerPselected {
font-weight: bold;
color: #843900;
font-family: Calibri;
font-size: 150%;
border-solid: solid 2px #7684a2;
}
.image {
position: relative;
width: 100%;
/* for IE 6 */
box-shadow: -1px -1px 3px #0a0c0f, 1px 1px 3px #47566b;
line-height: 0;
}
.imageTD {
vertical-align: top;
padding-bottom: 10px;
}
h2 {
position: absolute;
bottom: 0px;
left: 10px;
width: 100%;
color: black;
font-family: Calibri;
}
/* COLORS FOR H2*/
.blue {
color: #0033cc;
text-shadow: 1px 1px 1px #002699;
}
.red {
color: #4d0000;
text-shadow: 1px 1px 1px #1a0000;
}
.imageLink:hover {
opacity: 0.66;
}
<!DOCTYPE html>
<html lang="en">
<head>
<link rel="stylesheet" href="css/main.css">
<meta charset="UTF-8">
<title>Marc</title>
</head>
<body>
<div class="page-wrap">
<header>
<h1>
Homeless Helpers
</h1>
<table class="headerTable" , width="100%">
<tr>
<th width="20%">
<p class="headerP">
Message
</p>
</th>
<th width="20%">
<p class="headerP">
Goal
</p>
</th>
<th width="20%">
<p class="headerP">
Testimonials
</p>
</th>
<th width="20%">
<p class="headerP">
Media
</p>
</th>
<th width="20%">
<p class="headerP">
Donate
</p>
</th>
</tr>
</table>
</header>
<table>
<tr>
<td width="33%">
<div class="image">
<a href="code.html">
<div style='width:100%;height:100%'>
<img src='imgs/tweepy.png' style='width:100%;height:500px' alt='[]' class="imageLink" />
<h2 class="blue"> Care Packages</h2>
</div>
</a>
</div>
</td>
<td width="33%" , class="imageTD">
<div class="image">
<div style='width:100%;height:100%'>
<img src='http://placehold.it/1000x1000' style='width:100%;height:500px' alt='[]' , align="top" />
</div>
</div>
</td>
<td width="33%" , class="imageTD">
<div class="image">
<div style='width:100%;height:100%'>
<img src='http://placehold.it/1000x1000' style='width:100%;height:500px' alt='[]' , align="top" />
</div>
</div>
</td>
</tr>
</table>
<table>
<tr>
<td width="25%" , class="imageTD">
<div class="image">
<div style='width:100%;height:100%'>
<img src='http://placehold.it/1000x1000' style='width:100%;height:300px' alt='[]' />
</div>
</div>
</td>
<td width="25%" , class="imageTD">
<div class="image">
<div style='width:100%;height:100%'>
<img src='http://placehold.it/1000x1000' style='width:100%;height:300px' alt='[]' />
<h2 class="red"> This is a test red</h2>
</div>
</div>
</td>
<td width="50%" , class="imageTD" , rowspan="2">
<div class="image">
<div style='width:100%;height:100%'>
<img src='http://placehold.it/1000x1000' style='width:100%;height:614px' alt='[]' />
<h2 class="red"> This is a test red</h2>
</div>
</div>
</td>
</tr>
<tr>
<th colspan="2" , width="50%" , class="imageTD">
<div class="image">
<div style='width:100%;height:100%'>
<img src='http://placehold.it/1000x300' style='width:100%;height:300px' alt='[]' />
</div>
</div>
</th>
</tr>
</table>
</div>
<footer class="site-footer">
<p class="footer">
made by awesome people.
</p>
</footer>
</body>
</html>
How can I make it so that the images hold a ratio of 4:3 when the window is resized?
Change the <img> heights to auto works.
https://jsfiddle.net/JustusFT/3qtb1r9v/
However, I suggest you use a grid system such as bootstrap rather than using tables.
HTML:
<div class="page-wrap">
<header>
<h1>
Homeless Helpers
</h1>
<table class="headerTable" , width="100%">
<tr>
<th width="20%">
<p class="headerP">
Message
</p>
</th>
<th width="20%">
<p class="headerP">
Goal
</p>
</th>
<th width="20%">
<p class="headerP">
Testimonials
</p>
</th>
<th width="20%">
<p class="headerP">
Media
</p>
</th>
<th width="20%">
<p class="headerP">
Donate
</p>
</th>
</tr>
</table>
</header>
<table>
<tr>
<td width="33%">
<div class="image">
<a href="code.html">
<div style='width:100%;height:100%'>
<img src='imgs/tweepy.png' style='width:100%;height:auto' alt='[]' class="imageLink" />
<h2 class="blue"> Care Packages</h2>
</div>
</a>
</div>
</td>
<td width="33%" , class="imageTD">
<div class="image">
<div style='width:100%;height:100%'>
<img src='http://placehold.it/1000x1000' style='width:100%;height:auto' alt='[]' , align="top" />
</div>
</div>
</td>
<td width="33%" , class="imageTD">
<div class="image">
<div style='width:100%;height:100%'>
<img src='http://placehold.it/1000x1000' style='width:100%;height:auto' alt='[]' , align="top" />
</div>
</div>
</td>
</tr>
</table>
<table>
<tr>
<td width="25%" , class="imageTD">
<div class="image">
<div style='width:100%;height:100%'>
<img src='http://placehold.it/1000x1000' style='width:100%;height:auto' alt='[]' />
</div>
</div>
</td>
<td width="25%" , class="imageTD">
<div class="image">
<div style='width:100%;height:100%'>
<img src='http://placehold.it/1000x1000' style='width:100%;height:auto' alt='[]' />
<h2 class="red"> This is a test red</h2>
</div>
</div>
</td>
<td width="50%" , class="imageTD" , rowspan="2">
<div class="image">
<div style='width:100%;height:100%'>
<img src='http://placehold.it/1000x1000' style='width:100%;height:auto' alt='[]' />
<h2 class="red"> This is a test red</h2>
</div>
</div>
</td>
</tr>
<tr>
<th colspan="2" , width="50%" , class="imageTD">
<div class="image">
<div style='width:100%;height:100%'>
<img src='http://placehold.it/1000x300' style='width:100%;height:auto' alt='[]' />
</div>
</div>
</th>
</tr>
</table>
</div>
<footer class="site-footer">
<p class="footer">
made by awesome people.
</p>
</footer>

Show several div on hover

I have 4 divs and 4 images and each of them has an ID. I need to show another div when you hover the first div's image.
I wrote this code but only the first image with ID="insta2" and div ID="iinsta2" worked.
<style type="text/css">
#insta1{display:none}
#insta2{display:none}
#insta3{display:none}
#insta4{display:none}
#iinsta1:hover + #insta1 {
display: block;
}
#iinsta2:hover + #insta2 {
display: block;
}
#iinsta3:hover + #insta3 {
display: block;
}
#iinsta4:hover + #insta4 {
display: block;
}
</style>
And body:
<tr>
<td colspan="3" rowspan="2" style="text-align:center; width:30%">
<div id="insta1"><p> Hover 1 </p></div>
<img id="iinsta2" src="url" style="width:100% ; height:auto">
<div id="insta2"> <p> Hover </p></div>
</td>
<td colspan="4" style="text-align:center; width:40%">
<img id="iinsta1" src="url" style="width:100% ; height:auto">
</td>
<td colspan="3" rowspan="2" style="text-align:center; width:30%">
<div id="insta3"><p> Hover 3 </p></div>
<img id="iinsta3" src="url" style="width:100% ; height:auto">
<div id="insta4"> <p> Hover 4 </p> </div>
</td>
</tr>
<tr>
<td colspan="4" style="text-align:center; width:40%">
<img id="iinsta4" src="url" style="width:100% ; height:auto">
</td>
</tr>
Use this way:
#insta1,
#insta2,
#insta3,
#insta4 {
display: none;
}
#iinsta1:hover + #insta1,
#iinsta2:hover + #insta2,
#iinsta3:hover + #insta3,
#iinsta4:hover + #insta4 {
display: block;
}
<table>
<tr>
<td colspan="3" rowspan="2" style="text-align:center; width:30%">
<div id="insta1">
<p>Hover 1</p>
</div>
<img id="iinsta2" src="url" style="width:100% ; height:auto">
<div id="insta2">
<p>Hover</p>
</div>
</td>
<td colspan="4" style="text-align:center; width:40%">
<img id="iinsta1" src="url" style="width:100% ; height:auto">
</td>
<td colspan="3" rowspan="2" style="text-align:center; width:30%">
<img id="iinsta3" src="url" style="width:100% ; height:auto">
<div id="insta3">
<p>Hover 3</p>
</div>
</td>
</tr>
<tr>
<td colspan="4" style="text-align:center; width:40%">
<img id="iinsta4" src="url" style="width:100% ; height:auto">
<div id="insta4">
<p>Hover 4</p>
</div>
</td>
</tr>
</table>
The + object can be used only with siblings that are next. Also, I have reduced your CSS. Please use absolute positions for positioning the :hovers. And, if you wanna maintain the HTML layout, you need to use JavaScript for this.
img ~ p {
visibility: hidden;
}
img:hover ~ p {
visibility: visible;
}
<table border=1>
<tr>
<td>
<div class="item">
<h1>Hover 1</h1>
<img src="http://placekitten.com/100" />
<p>Hover</p>
</div>
</td>
<td>
<div class="item">
<h1>Hover 1</h1>
<img src="http://placekitten.com/100" />
<p>Hover</p>
</div>
</td>
<td>
<div class="item">
<h1>Hover 1</h1>
<img src="http://placekitten.com/100" />
<p>Hover</p>
</div>
</td>
<td>
<div class="item">
<h1>Hover 1</h1>
<img src="http://placekitten.com/100" />
<p>Hover</p>
</div>
</td>
</tr>
</table>
The example here seems complicated so I boiled it down to what I understood the question to be. I hope this helps. Feed back is welcome.

table in div goes outside of container in responsive mode

I have a table that is inside of a div. In responsive mode, the table goes outside of the div area and looks like this:
I am trying to have the table move to center in responsive mode. I want it to look like this:
Currently, when the screen width gets small, the table will not get close enough to the left to fit in the container. I do not want the table to go outside of the container.
Does anyone know how I can accomplish this?
.slice-table {
vertical-align: middle;
display: block;
cursor: pointer;
cursor: hand;
}
.inner {
width: 50%;
margin: 0 auto;
font-size: 6px;
color: #FFFFFF;
}
.spacer-20 {
font-size: 0;
height: 20px;
line-height: 0;
}
<link rel="stylesheet" href="https://maxcdn.bootstrapcdn.com/bootstrap/3.3.6/css/bootstrap.min.css" integrity="sha384-1q8mTJOASx8j1Au+a5WDVnPi2lkFfwwEAa8hDDdjZlpLegxhjVME1fgjWPGmkzs7" crossorigin="anonymous">
<div class="st-container">
<div class="st-content" id="content">
<div class="st-content-inner">
<div class="container-fluid">
<div class="row">
<div class="col-md-7">
<div class="panel panel-default">
<div class="panel-body">
<!-- Progress table -->
<div>
<div class="inner">
<table id="Table_01" width="401" height="400" border="0" cellpadding="0" cellspacing="0">
<tr>
<td width="401" height="400" align="center" valign="middle" bgcolor="#75904A">Cell 1</td>
</tr>
</table>
</div>
</div>
</div>
</div>
</div>
</div>
</div>
</div>
</div>
</div>
How about adding
overflow-x: auto;
To the div.inner element. Altough I´m not sure if this is what you want. Your CSS would be something like
.inner {
width: 50%;
margin: 0 auto;
font-size: 6px;
color: #FFFFFF;
overflow-x: auto; // When the table exceeds the size of the container, the container creates a scrollbar.
}
I took the liberty of adding a second cell for demostrations sake.
.slice-table {
vertical-align: middle;
display: block;
cursor: pointer;
cursor: hand;
}
.inner {
width: 50%;
margin: 0 auto;
font-size: 6px;
color: #FFFFFF;
overflow-x: auto;
}
.spacer-20 {
font-size: 0;
height: 20px;
line-height: 0;
}
<link rel="stylesheet" href="https://maxcdn.bootstrapcdn.com/bootstrap/3.3.6/css/bootstrap.min.css" integrity="sha384-1q8mTJOASx8j1Au+a5WDVnPi2lkFfwwEAa8hDDdjZlpLegxhjVME1fgjWPGmkzs7" crossorigin="anonymous">
<div class="st-container">
<div class="st-content" id="content">
<div class="st-content-inner">
<div class="container-fluid">
<div class="row">
<div class="col-md-7">
<div class="panel panel-default">
<div class="panel-body">
<!-- Progress table -->
<div>
<div class="inner">
<table id="Table_01" width="401" height="400" border="0" cellpadding="0" cellspacing="0">
<tr>
<td width="401" height="400" align="center" valign="middle" bgcolor="#75904A">Cell 1</td>
<td width="401" height="400" align="center" valign="middle" bgcolor="red">Cell 2</td>
</tr>
</table>
</div>
</div>
</div>
</div>
</div>
</div>
</div>
</div>
</div>
</div>
Try the img-responsive class on your images like this:
<!DOCTYPE html>
<html>
<head>
<style>
.slice-table {
vertical-align: middle;
display: block;
cursor: pointer;
cursor: grab;
}
.inner {
width: 50%;
margin: 0 auto;
font-size: 6px;
color: #FFFFFF;
}
.spacer-20 {
font-size: 0;
height: 20px;
line-height: 0;
}
</style>
<meta charset="utf-8" />
<title></title>
<link rel="stylesheet" href="https://maxcdn.bootstrapcdn.com/bootstrap/3.3.6/css/bootstrap.min.css" integrity="sha384-1q8mTJOASx8j1Au+a5WDVnPi2lkFfwwEAa8hDDdjZlpLegxhjVME1fgjWPGmkzs7" crossorigin="anonymous">
</head>
<body>
<div class="st-container">
<div class="st-content" id="content">
<div class="st-content-inner">
<div class="container-fluid">
<div class="row">
<div class="col-md-7">
<div class="panel panel-default">
<div class="panel-body">
<!-- Progress table -->
<div>
<div class="inner">
<table id="Table_01" class="table-responsive" width="401" height="400" border="0" cellpadding="0" cellspacing="0">
<tr>
<td colspan="38">
<img class="slice-table img-responsive" src="{% static 'shared/app/images/floor-plan/floorplan_01.png' %}" width="400" height="4" alt="">
</td>
<td>
<img class="slice-table img-responsive" src="{% static 'shared/app/images/floor-plan/spacer.gif' %}" width="1" height="4" alt="">
</td>
</tr>
<tr>
<td rowspan="48">
<img class="slice-table img-responsive" src="{% static 'shared/app/images/floor-plan/floorplan_02.png' %}" width="2" height="395" alt="">
</td>
<td width="61" height="48" colspan="3" rowspan="3" align="center" valign="middle" bgcolor="#75904A">Cell 1</td>
<td rowspan="5">
<img class="slice-table img-responsive" src="{% static 'shared/app/images/floor-plan/floorplan_04.png' %}" width="2" height="50" alt="">
</td>
<td width="58" height="48" colspan="3" rowspan="3" align="center" valign="middle" bgcolor="#75904A">Cell 2</td>
<td colspan="27">
<img class="slice-table img-responsive" src="{% static 'shared/app/images/floor-plan/floorplan_06.png' %}" width="212" height="2" alt="">
</td>
<td width="62" height="206" colspan="2" rowspan="24" align="center" valign="middle" bgcolor="#75904A">Cell 3</td>
<td rowspan="48">
<img class="slice-table img-responsive" src="#" width="3" height="395" alt="">
</td>
<td>
<img class="slice-table img-responsive" src="#" width="1" height="2" alt="">
</td>
</tr>
</table>
</div>
</div>
</div>
</div>
</div>
</div>
</div>
</div>
</div>
</div>
</body>
</html>