I’m creating an email template and using tables to position stuff. I wanted to overlap an image over the other, but am not able to do so. I’m using the following within a row, but it doesn’t seem to work. If someone could help me out, I’d really appreciate it.
<td colspan="3" style="padding: 14px; background-color: rgb(241, 241, 241); font-size: 11px; font-family: arial,helvetica; color: rgb(69, 85, 95);
.under{
position:absolute;
left:80px;
top:0px;
z-index:-1;
}
.over
{
position:absolute;
left:50px;
z-index:1;
}">
You have several problems:
styleattribute.position: static(the default) so they would be positioned with respect to (probably) the body rather than the table cell. Absolutely positioned elements are positioned with respect to their closest ancestor whose position is anything other than static.positionon a<td>may or may not work depending on the browser, CSS2 actually says that settingposition:relativeon table elements results in undefined behavior.You’ll need to put a
<div>inside your<td>and relatively position that. Then put the images inside the<div>and, since you’re dealing with email, inline their styles. The result will be something like this:I’ve added borders, kittens, and an explicit size on the
<div>for demo purposes. There’s a live version over here: http://jsfiddle.net/ambiguous/TkF24/Email clients will filter CSS and what gets through depends on the client. You might have to paste the images together by hand and then reference just one image to make it work reliably.