Ok, so maybe I'm slightly losing my mind but I'm trying to recreate a homepage that incorporates 2 background images into my CSS. I'm attempting to use one as a top image and one as a bottom image, and in the middle is a table that has links and images. However, for some reason, I'm having difficulty with pulling it all together to make it look like one smooth image.
For example, my container class (as shown below) only puts a border around the topBox class and not the entire container div. I want all 3 divs to have one border around it (coming from the container class) so that it looks as if its one image. Here is my HTML and CSS.
What am I doing wrong? Thanks in advance for any assistance!
#Container {
float:left;
width: inherit;
height: 400px;
margin-left: auto;
margin-right: auto;
border:1px solid #000000;
}
.boxTop {
position: relative;
left: 100;
top: 100;
width: inherit;
height: 95px;
background-image: url(http://ejgh.org/templates/ejgh/images/HL_logo.jpg);
background-repeat: no-repeat;
/*place background image css code here and remove line above*/
background-position: left 0px top 0px;
background-size: 300px;
}
.box {
position: relative;
left: 100;
top: 100;
width: 350px;
height: 550px;
border:0px solid #000000;
}
.boxBtm {
position: relative;
left: 100;
top: 100;
width: inherit;
height: 95px;
background-image: url(http://ejgh.org/templates/ejgh/images/healthyLifestyles_bottom.gif);
/*place background image css code here and remove line above*/
background-repeat: no-repeat;
background-position: left 0px bottom 0px;
background-size: 300px;
}
<div id="Container">
<div class="boxTop"></div>
<div class="box"><table width="300px">
<tbody>
<tr>
<td>
<table cellspacing="0" cellpadding="6">
<tbody>
<tr>
<td valign="top"><img style="border-width: 0px;" src="http://ejgh.org/images/stories/template/healthylifestyles/apple.jpg" alt="Image of Apple and Weights for homepage" width="86" height="86" /></td>
<td valign="top">
<h3>Become a Member</h3>
<p>Join Healthy Lifestyles and enjoy the benefits of membership.</p>
</td>
</tr>
<tr>
<td valign="top"><img style="border-width: 0px;" src="http://ejgh.org/images/stories/template/healthylifestyles/elderlycouple.jpg" alt="Image of elderly couple at hospital in New Orleans Louisiana" width="86" height="83" /></td>
<td valign="top">
<h3>Classes & Support</h3>
<p>Learn more about the classes, support groups, and health screenings we offer.</p>
</td>
</tr>
<tr>
<td valign="top"><img style="border-width: 0px;" src="http://ejgh.org/images/stories/template/healthylifestyles/tvspot.jpg" alt="Image of Liz Delsa Healthy Lifestyles Host" width="86" height="70" /></td>
<td valign="top">
<h3>Watch the TV Segment</h3>
<p>Watch Healthy Lifestyles TV segments as seen on WWL-TV.</p>
</td>
</tr>
<tr>
<td valign="top"><img src="http://ejgh.org/images/stories/yourhealthimages/healthylifestyles/MagazineCovers/summer2016.jpg" alt="Summer 2016 Healthy Lifestyles Cover" width="86" height="100" /></td>
<td valign="top">
<h3>Read the Magazine</h3>
<p>Read the latest Healthy Lifestyles Magazine as included in the Times-Picayune newspaper.</p>
</td>
</tr>
</tbody>
</table>
</td>
</tr>
</tbody>
</table></div>
<div class="boxBtm"></div>
</div>
Very simple answer, just remove the hight of the id #Container and it'll work. I hope this is what you where looking for ;)
You have set a specific height on your container, so your border is only going to be that height. If you set the height to 750 pixels, it is going to work.
#Container {
float: left;
width: inherit;
height: 750px;
margin-left: auto;
margin-right: auto;
border: 1px solid #000000;
}
.boxTop {
position: relative;
left: 100;
top: 100;
width: inherit;
height: 95px;
background-image: url(http://ejgh.org/templates/ejgh/images/HL_logo.jpg);
background-repeat: no-repeat;
/*place background image css code here and remove line above*/
background-position: left 0px top 0px;
background-size: 300px;
}
.box {
position: relative;
left: 100;
top: 100;
width: 350px;
height: 550px;
border: 0px solid #000000;
}
.boxBtm {
position: relative;
left: 100;
top: 100;
width: inherit;
height: 95px;
background-image: url(http://ejgh.org/templates/ejgh/images/healthyLifestyles_bottom.gif);
/*place background image css code here and remove line above*/
background-repeat: no-repeat;
background-position: left 0px bottom 0px;
background-size: 300px;
}
<div id="Container">
<div class="boxTop"></div>
<div class="box">
<table width="300px">
<tbody>
<tr>
<td>
<table cellspacing="0" cellpadding="6">
<tbody>
<tr>
<td valign="top">
<a href="http://ejgh.org/your-health/healthy-lifestyles/become-a-member-sp-1672965733">
<img style="border-width: 0px;" src="http://ejgh.org/images/stories/template/healthylifestyles/apple.jpg" alt="Image of Apple and Weights for homepage" width="86" height="86" />
</a>
</td>
<td valign="top">
<h3>Become a Member</h3>
<p>Join Healthy Lifestyles and enjoy the benefits of membership.</p>
</td>
</tr>
<tr>
<td valign="top">
<a href="/component/wrapper/?Itemid=203">
<img style="border-width: 0px;" src="http://ejgh.org/images/stories/template/healthylifestyles/elderlycouple.jpg" alt="Image of elderly couple at hospital in New Orleans Louisiana" width="86" height="83" />
</a>
</td>
<td valign="top">
<h3>Classes & Support</h3>
<p>Learn more about the classes, support groups, and health screenings we offer.</p>
</td>
</tr>
<tr>
<td valign="top">
<a href="/component/hwdvideoshare/?task=viewcategory&Itemid=166&cat_id=5">
<img style="border-width: 0px;" src="http://ejgh.org/images/stories/template/healthylifestyles/tvspot.jpg" alt="Image of Liz Delsa Healthy Lifestyles Host" width="86" height="70" />
</a>
</td>
<td valign="top">
<h3>Watch the TV Segment</h3>
<p>Watch Healthy Lifestyles TV segments as seen on WWL-TV.</p>
</td>
</tr>
<tr>
<td valign="top">
<a href="/your-health/healthy-lifestyles/healthy-lifestyles-magazine">
<img src="http://ejgh.org/images/stories/yourhealthimages/healthylifestyles/MagazineCovers/summer2016.jpg" alt="Summer 2016 Healthy Lifestyles Cover" width="86" height="100" />
</a>
</td>
<td valign="top">
<h3>Read the Magazine</h3>
<p>Read the latest Healthy Lifestyles Magazine as included in the Times-Picayune newspaper.</p>
</td>
</tr>
</tbody>
</table>
</td>
</tr>
</tbody>
</table>
</div>
<div class="boxBtm"></div>
</div>
This can be a lot simpler - you only need one wrapper div, not three. (You also shouldn't be using a table for layout purposes, but that's a whole other subject. For now, this'll work if you drop your table in where the content p tags are.)
Here's how to get roughly the visuals you want with a lot less code:
.box {
width: 300px;
border: 1px solid;
border-radius: 0 0 9px 9px;
/* You can specify multiple background images like this: */
background-image: url(http://ejgh.org/templates/ejgh/images/HL_logo.jpg), url(http://ejgh.org/templates/ejgh/images/healthyLifestyles_bottom.gif);
background-size: 100% auto;
background-repeat: no-repeat;
/* first position goes with the first image url and vice versa */
background-position: top, bottom;
/* 130px padding on top to create room for the "lifestyles" logo
20px on the sides for breathing room
50px at the bottom to create room for the green gradient
tweak these values till you like the spacing */
padding: 130px 20px 50px;
}
<div class="box">
<p>content</p>
<p>content</p>
<p>content</p>
</div>
Related
I have written some HTML to add as a disclaimer to company emails, which for the most part works a treat. I recently had to add some extras to it, by means of an overlayed image or 2. When compiling the HTML in web, it looks exactly as I want it to. However as soon as it is sent by email the images are blown up, one doesn't even show and the formatting is all wrong.
I think it must be to do with the type of HTML used by Microsoft when adding a disclaimer, but I don't know enough about it to know where I'm wrong.
Any assistance greatly appreciated!
```
<tr>
<style>
.parent {
position: relative;
top: 0;
left: 0;
background-image:url(https://www.douglas-scott.co.uk/storage/downloads/mwLPJ1KUs9YYEPTLfI3FaF84iaeXQjxDLvHcSLKh.png);
background-size: 100% ;
overflow: hidden;
background-repeat: no-repeat;
height: 110;
text-decoration: none;
}
.image2 {
position: absolute;
top: 5px;
left: 10px;
height: 100;
max-height: 100;
text-decoration: none;
}
.image3 {
position: absolute;
top: 10px;
right: 10px;
height: 100;
max-height: 100;
text-decoration: none;
}
</style>
<td class="parent">
<img class="image2" alt="SS22" src="https://www.douglas-scott.co.uk/storage/downloads/QRIe6dIZLotRovMPQosPFm1lqOBGeF5hPEZdFqJQ.png" align="left">
<img class="image3" alt="£250 L2S Voucher" src="https://www.douglas-scott.co.uk/storage/downloads/l4BjlWxpIbGBzzBKQr12CiMl6zhMPAzU0sFd3NYI.png" align="right">
</td>
</tr>
```
This is my code, I only included the bit that isn't working. On web it is displayed as this: correct output. This is how I am intending for it to show.
However when sent as email, this is how it is outputting: actual output
There are few problems here:
MS Outlook doesn't support absolute or relative positioning
MS Outlook doesn't support background images using CSS.
Images need height and width attributes.
Fortunately there are solutions for all.
Images don't self-size as they do on the web, so adding height and width attributes should solve that.
Regarding the layout, instead of using css positioning to lay out the images, they could be put into a basic two column <table>, like so:
<td class="parent" style="background-image:url(https://www.douglas-scott.co.uk/storage/downloads/mwLPJ1KUs9YYEPTLfI3FaF84iaeXQjxDLvHcSLKh.png); background-size: 100%;">
<table role="presentation" cellspacing="0" cellpadding="0" border="0" width="100%">
<tr>
<td style="width: 50%; padding: 5px 10px; height: 110px; text-decoration: none;">
<img alt="SS22" src="https://www.douglas-scott.co.uk/storage/downloads/QRIe6dIZLotRovMPQosPFm1lqOBGeF5hPEZdFqJQ.png" align="left" width="300" height="50">
</td>
<td style="width: 50%; padding: 10px; height: 110px; text-decoration: none; text-align: right;">
<img alt="£250 L2S Voucher" src="https://www.douglas-scott.co.uk/storage/downloads/l4BjlWxpIbGBzzBKQr12CiMl6zhMPAzU0sFd3NYI.png" align="right" width="300" height="50">
</td>
</tr>
</table>
</td>
It might seem archaic, but this is the level of CSS that MS Outlook supports and it achieves the design linked in your question.
Regarding background images, we can use VML to simulate background CSS properties in a way that Outlook supports.
So we can wrap this code in a <!--[if mso]> <![endif]--> so only Windows Outlook reads and renders it, and then repeat the background image styles in VML:
<td class="parent" style="background-image:url(https://www.douglas-scott.co.uk/storage/downloads/mwLPJ1KUs9YYEPTLfI3FaF84iaeXQjxDLvHcSLKh.png); background-size: 100%;">
<!--[if mso]>
<v:rect stroked="false" style="width:600px;height:1100px;">
<v:fill type="frame" src="https://www.douglas-scott.co.uk/storage/downloads/mwLPJ1KUs9YYEPTLfI3FaF84iaeXQjxDLvHcSLKh.png" color="#000000" />
<![endif]-->
<table role="presentation" cellspacing="0" cellpadding="0" border="0" width="100%">
<tr>
<td style="width: 50%; padding: 5px 10px; height: 110px; text-decoration: none;">
<img alt="SS22" src="https://www.douglas-scott.co.uk/storage/downloads/QRIe6dIZLotRovMPQosPFm1lqOBGeF5hPEZdFqJQ.png" align="left" width="300" height="50">
</td>
<td style="width: 50%; padding: 10px; height: 110px; text-decoration: none; text-align: right;">
<img alt="£250 L2S Voucher" src="https://www.douglas-scott.co.uk/storage/downloads/l4BjlWxpIbGBzzBKQr12CiMl6zhMPAzU0sFd3NYI.png" align="right" width="300" height="50">
</td>
</tr>
</table>
<!--[if mso]>
</v:rect>
<![endif]-->
</td>
This should give you pretty good coverage in email clients, including Outlook.
I would also recommend inlining your CSS since not every email client supports the <style> tag.
I have the following code
table,
th,
td {
border: 1px solid black;
border-collapse: collapse;
}
th,
td {
padding: 5px;
text-align: left;
}
img {
object-fit: cover;
}
.ninja {
font-family: Bebas Neue;
font-size: 30px;
}
<table style="width:80%">
<tr>
<th rowspan="3" width="50%">
<img style="display: block;width: 100%;height: 100%" src="image.jpg" />
</th>
<td valign="top"><strong class=n inja>WHY WONT YOU LET IT GO</strong></td>
</tr>
<tr style="height: 0;">
<td>55577855</td>
</tr>
<tr style="height: 0;">
<td>55577855</td>
</tr>
<tr>
<td>HAHAHAHA</td>
</tr>
</table>
The problem is, the text all have big spaces all the way down because their total height has to account for the image's height. How do I make it the other way around as I would be fine with the image being minimized or made smaller so the text does not have the long spaces below their content?
I have to create a very simple web page for a blog but i'm not very good with html e css and i'm stack.
How can i remove the space between the rows in the table? See the picture: (enter image description here)
I have to remove also the space in the bottom left cell, which has four other cells inside it.
Then i don't know how to resize the page when the window change(for example on mobile phones), any suggestion?
Thanks!!
this is the html & css code:
body {
background-image: url(E:/Workspace/Sviluppo_Pagine_Internet/Blog/Blog_Images/AGGIUSTATE/UBUNTU.png);
background-size: 100% 40%;
background-repeat: no-repeat;
background-color: #191970;
width: 100%;
}
td {
padding:0px;
}
tr{
}
table {
border-collapse: collapse;
}
.mainTable {
margin-top: 50%;
}
.image6x6 {
width: 600px;
height: 600px;
}
.image3x3 {
width: 300px;
height: 300px;
}
.td6x6 {
width: 600px;
height: 600px;
}
}
.td3x3 {
width: 300px;
height: 300px;
}
<!DOCTYPE html>
<html>
<head>
<link type="text/css" rel="stylesheet" href="Main_Page.css"/>
<title></title>
</head>
<body>
<center><table class="mainTable">
<tr>
<!--PRIMA CELLA-->
<td class"td6x6">
<a href="E:\Workspace\Sviluppo_Pagine_Internet\Blog\BlogPage.html">
<img src="E:\Workspace\Sviluppo_Pagine_Internet\Blog\Blog_Images\AGGIUSTATE\Blog.png" class="image6x6">
</a>
</td>
<!--SECONDA CELLA-->
<td class"td6x6">
<a href="https://github.com/github" target="GitHub">
<img src="E:\Workspace\Sviluppo_Pagine_Internet\Blog\Blog_Images\AGGIUSTATE\GitHub.png" class="image6x6">
</a>
</td>
</tr>
<tr>
<!--TERZA CELLA-->
<td class"td6x6">
<table>
<tr>
<td class"td3x3">
<a href="mailto:email">
<img src="E:\Workspace\Sviluppo_Pagine_Internet\Blog\Blog_Images\AGGIUSTATE\Email.png" class="image3x3">
</a>
</td>
<td class"td3x3">
<a href="https://www.linkedin.com/in/linked" target="Linkedin">
<img src="E:\Workspace\Sviluppo_Pagine_Internet\Blog\Blog_Images\AGGIUSTATE\Linkedin.png" class="image3x3">
</a>
</td>
</tr>
<tr>
<td class"td3x3">
<a href="https://www.facebook.com/fb" target="Facebook">
<img src="E:\Workspace\Sviluppo_Pagine_Internet\Blog\Blog_Images\AGGIUSTATE\Facebook.png" class="image3x3">
</a>
</td>
<td class"td3x3">
<a href="https://www.instagram.com/dddinst/" target="Instagram">
<img src="E:\Workspace\Sviluppo_Pagine_Internet\Blog\Blog_Images\AGGIUSTATE\Instagram.png" class="image3x3">
</a>
</td>
</tr>
</table>
</td>
<!--QUARTA CELLA-->
<td class"td6x6">
<a href="E:\Workspace\Sviluppo_Pagine_Internet\Blog\ContactPage.html">
<img src="E:\Workspace\Sviluppo_Pagine_Internet\Blog\Blog_Images\AGGIUSTATE\About.png" class="image6x6">
</a>
</td>
</tr>
</table></center>
<div>
</div>
<div style="position: relative; background-color: black; width: 100%; height: 100px; margin-bottom: 0%; margin-top: 3%">
<h4 style="text-align: center; color: blue; padding-top: 2%">emailaddress</h4>
</div>
put "vertical-align: bottom" on all of your images.
td img {
vertical-align: bottom;
}
I have this css caption effect:
.cell {
position: relative;
width: 180px;
height: 180px;
}
.caption {} .cell .caption {
opacity: 0;
text-decoration-color: gray;
text-align: center;
background: #eaeaea;
position: absolute;
font-weight: bold;
width: 180px;
height: 180px;
}
.cell:hover .caption {
box-shadow: 0 5px 2px #777;
cursor: pointer;
opacity: 0.7;
}
<table style="text-align: left; width: 100%;" border="0" cellpadding="0" cellspacing="0">
<c:forEach var="product" items="${categoryProducts}" varStatus="iter">
<td>
<tbody>
<tr>
<td style="vertical-align: middle; width: 180px; text-align: center; height: 180px;" class="cell">
<a href="product?${product.id}">
<img class="img" alt="" src="${initParam.productImagePath}${product.name}.jpg" />
<div class="caption">
<br>view details</div>
</a>
<br>
</div>
</td>
<td style="vertical-align: middle; width: 140px; text-align: center;">${product.name}
<br>
</td>
<td style="vertical-align: middle; width: 125px; text-align: center;">$ ${product.price}
<br>
</td>
<td style="vertical-align: middle; width: 125px; text-align: center;">
<form action="addToWishlist" method="post">
<br>
<br>
<input name="productId" value="${product.id}" type="hidden">
<input class="submit" value="<fmt:message key='AddToWishlist'/>" type="submit">
</form>
<br>
</td>
<td style="vertical-align: middle; width: 123px; text-align: center;">
<form action="addToCart" method="post">
<br>
<br>
<input name="productId" value="${product.id}" type="hidden">
<input class="submit" value="<fmt:message key='AddToCart'/>" type="submit">
</form>
<br>
</td>
</tr>
</tbody>
</c:forEach>
</table>
The code in itself works perfectly fine. The caption shows as expected. The only thing tho, when there's an image inside of the cell, there is a display problem when mouse hover the image as shown from my local browser run from the IDE:
The caption overlays the next cell... What could cause this? I tried to play around with the .img and the .caption but cannot seem to find a solution...
Here the full image overlay caption effect i'm trying to accomplish:
http://www.corelangs.com/css/box/caption.html
So the problem in your screenshot is the caption of the bottom image overlaying on top of the first image? Not sure I understand this correctly, but if so there are three simple solutions I can think about:
Increase the margin between your images / rows
On :hover, increase margin, although that could be poor UX
Increase opacity from 0.7 to 1 so it overlays, but you cannot see the first cell through it
I have some problems skinning a rounded corner table.
Take a look at the image please:
And here goes the code:
<table id="whitePanel" width="190px" cellpadding="0" cellspacing="0" border="0" >
<tr>
<td>
<img src="assets/images/lightRoundedCorners/tl.png" width="8" height="8" border="0" alt="..." />
</td>
<td>
<img src="assets/images/lightRoundedCorners/t.png" alt="..." height="8" width="100%" />
</td>
<td>
<img src="assets/images/lightRoundedCorners/tr.png" width="8" height="8" border="0" alt="..." />
</td>
</tr>
<tr>
<td>
<img src="assets/images/lightRoundedCorners/l.png" width="8" alt="..." height="100%" border="0"/>
</td>
<td align="center" border="0" style="background: url(assets/images/lightRoundedCorners/c.png) repeat">
ACTUAL CONTENT
<p>1. Item 1</p>
<p>1. Item 1</p>
<p>1. Item 1</p>
</td>
<td>
<img src="assets/images/lightRoundedCorners/r.png" width="8" alt="..." height="100%" border="0"/>
</td>
</tr>
<tr>
<td>
<img src="assets/images/lightRoundedCorners/bl.png" width="8" height="8" border="0" alt="..." />
</td>
<td>
<img src="assets/images/lightRoundedCorners/b.png" alt="..." height="8" width="100%" border="0"/>
</td>
<td>
<img src="assets/images/lightRoundedCorners/br.png" width="8" height="8" border="0" alt="..." />
</td>
</tr>
Any suggestions?
I am going to scalp you for using tables for non tabular data,
For god's sake man it's 2011 use divs and css!
http://css-discuss.incutio.com/wiki/Why_I_think_divs_are_better_than_tables
One solution could be to use css only without images to achieve what you need. check the following:
css
table {
-moz-border-radius: 6px; /* FF1+ */
-webkit-border-radius: 6px; /* Saf3-4 */
border-radius: 6px; /* Opera 10.5, IE9, Saf5, Chrome */
-moz-box-shadow: 0 0 6px #959595 inset;
-webkit-box-shadow: 0px 0px 6px #959595 inset; /* Saf3.0+, Chrome */
box-shadow: 0px 0px 6px #959595 inset; /* Opera 10.5, IE9 */
border: 1px solid grey;
color: #00769B;
font-size: 1.1em;
text-align: center;}
html
<table id="whitePanel" width="190px" cellpadding="0" cellspacing="0" border="0" >
<tr>
<td>ACTUAL CONTENT
<p>1. Item 1</p>
<p>1. Item 1</p>
<p>1. Item 1</p>
</td>
</tr>
</table>
Demo: http://jsbin.com/ebove4/3
Because internet explorer doesn't understand these css3 properties, you can use css3pie.
Try adding the following CSS style to your table...
#whitePanel {
border-collapse:collapse;
}
Ok, here is the code I used to solve the problem, I hope it helps all of you!
This method does not use Javascript, only CSS and HTML.
Result:
I still have some problems with the right corners ( top and bottom ) I hope to fix it soon.
Assets:
I'm sorry to put it like this but I don't have a development server right now.
b:
bl:
br:
c:
l:
r:
t:
tl:
tr:
Here is the HTML code ( DIVS ):
<div class="dialog">
<div class="hd">
<div class="c">
</div>
</div>
<div class="bd">
<div class="c">
<div class="s">
<!-- content area -->
<h3>a<b>developer</b>?</h3>
public <b>API</b> here!
<!-- content area -->
</div>
</div>
</div>
<div class="ft"><div class="c"></div></div>
</div>
And here the css code:
.dialog {
width:200px;
margin:10px 10px 0px 0px;
}
.dialog .hd .c,
.dialog .ft .c {
font-size:1px; /* ensure minimum height */
height:8px;
}
.dialog .ft .c {
height:8px;
}
.dialog .hd {
background:transparent url(../assets/images/lightRoundedCorners/tl.png) no-repeat ;
}
.dialog .hd .c {
background:transparent url(../assets/images/lightRoundedCorners/tr.png) no-repeat right 0px;
}
.dialog .bd {
background:transparent url(../assets/images/lightRoundedCorners/l.png) repeat-y 0px 0px;
}
.dialog .bd .c {
background:transparent url(../assets/images/lightRoundedCorners/r.png) repeat-y right 0px;
}
.dialog .bd .c .s {
margin:0px 8px 0px 8px;
background:transparent url(../assets/images/lightRoundedCorners/c.png) repeat 0px 0px;
padding:1px;
padding-left: 5px;
padding-bottom: 10px;
}
.dialog .ft {
background:transparent url(../assets/images/lightRoundedCorners/bl.png) no-repeat 0px 0px ;
}
.dialog .ft .c {
background:transparent url(../assets/images/lightRoundedCorners/br.png) no-repeat right 0px;
}
Hope it helps!