Below is the html page.
There is a dynamic url variable which will generate the tag.
As there are other static tag, the whole css for tag is applying to all of those links.
How can I control dynamic variable which will generate the tag using css?
I tried to put that variable insides tags and not working. Any idea?
a { color: #f05322;
text-decoration: underline;
}
a:hover { color: #f05322;
text-decoration: underline;
}
<table width="100%" height="100%" cellpadding="0" cellspacing="0" border="0" style="" bgcolor="#ffffff">
<tbody>
<tr height="0" style="padding:0px;vertical-align:top">
<td height="0" style="padding:0px;">
<table style="width:900px; margin:auto;" align="center" border="0" cellpadding="0" cellspacing="0" width="900">
<tbody>
<tr>
<td style="padding:20px 10px 10px 35px; " bgcolor="#E6E6E6">
<font face="Arial, Helvetica, sans-serif" style="font-size:14px; color:#3A393A;"> © test | www.test.com</font>
</td>
</tr>
<tr>
<td>
${someURL}
</td>
</tr>
</tbody>
</table>
</td>
</tr>
</tbody>
</table>
Easiest is to add a class to the parent (td):
<td class="someClass">
${someURL}
</td>
.someClass a {
background: yellow;
}
JSFiddle
When you're unable to change the structure you can target that cell with this CSS:
table table tr:nth-of-type(2) a {
background: yellow;
}
JSFiddle
Please note that option is the cleanest solution... if you drastically change your structure, you'll need to change option 2 too.
Related
I have the following 2x1 cell where I have an image in cell 1 and text in cell 2. I want rounded corners such as the examples found here. I used border-radius but I still have hard corners. I cannot use CSS as this is for a newsletter that will be emailed out. I appreciate any insight.
<table border="3" width="723" cellspacing="0" cellpadding="0" style="border-collapse:collapse border-radius:15px 50px">
<td style="border:none">
<table align="left" border="0" cellspacing="0" cellpadding="10">
<tbody>
<tr>
<td>
<img alt="" width="275" height="150" style="border-width: 0px" src="http://www.path.com/to/image.png"></img>
</td>
</tr>
</tbody>
</table>
</td>
<td style="border:none">
<table align="left" border="0" cellspacing="0" cellpadding="10">
<tbody>
<tr>
<td>
<span style="font-family: trebuchet ms,verdana,arial,helvetica,sans-serif; font-size: 12px;">
<p>test text</p>
</span></td>
</tr>
</tbody>
</table>
</td>
</table>
The issue is with border-collapse: collapse; you need to use the border-collapse: separate;
<html>
<head>
<style>
td > span {
font-family: trebuchet ms,verdana,arial,helvetica,sans-serif;
font-size: 12px;
}
td > img {
/* border-width: 0px; */
border-radius: 15px 0 0 50px;
}
body > table {
border-collapse: separate;
border-radius: 15px 50px;
border: 3px solid #000;
}
</style>
</head>
<body>
<table width="723" cellspacing="0" cellpadding="0" >
<tr>
<td>
<table align="left" border="0" cellspacing="0" cellpadding="10">
<tbody>
<tr>
<td>
<img alt="" width="275" height="150"src="http://via.placeholder.com/275x150"></img>
</td>
</tr>
</tbody>
</table>
</td>
<td>
<table align="left" border="0" cellspacing="0" cellpadding="10">
<tbody>
<tr>
<td>
<span>
<p>test text</p>
</span></td>
</tr>
</tbody>
</table>
</td>
</tr>
</table>
</body>
</html>
Results in:
You can see documentation about the different styles of border on tables at https://www.w3.org/TR/CSS21/tables.html#separated-borders and https://www.w3.org/TR/CSS21/tables.html#collapsing-borders. The snippet above should work in an email or as a stand alone page but would recommend separating the CSS for a standalone page.
Change your table tag from
<table border="3" width="723" cellspacing="0" cellpadding="0" style="border-collapse:collapse border-radius:15px 50px">
to
<table border="3" width="723" cellspacing="0" cellpadding="0" >
And use this CSS
table {
border: 2px solid;
border-radius: 25px;
}
If you only want this rounded corner on the outer table, then give it an ID or a class and reference the new ID or class in the CSS instead of referencing all table elements.
I would like to avoid the color change in an html email template when a anchor is clicked.
In Outlook, a white anchor get purple after it's clicked.
The code:
<table style="background-color: #404040; width: 100%;">
<tbody>
<tr>
<td>
<table cellpadding="3" cellspacing="0" border="0" style="width: 100%; margin-bottom: 2px">
<tbody>
<tr>
<td width="10px"></td>
<td>Oficinas</td>
<td width="12px"></td>
</tr>
</tbody>
</table>
</td>
</tr>
</tbody>
</table>
Add this to your HTML:
<style>
a:visited {
color: #FFFFFF; /* Or whatever white you're using */
}
</style>
It's just injecting CSS into your page to handle the a tag once it's been visited.
I am trying to create a single page, will be used as a newsletter, so my code is html/css inline.
http://jsfiddle.net/Chamberja/6t9r14ew/
I want to add a background image behind that entire table so the logo and the text will appear in the foreground.
I have tried adding
style="background-image: url("bg.jpg")"
and
style= "background: url(bg.jpg)"
So the final code looks like
<table style="background: url(sportip.biz/alpha.jpg)" border="0" cellpadding="0" cellspacing="0" align="left" class="deviceWidth">
<tr>
<td style="padding:10px 20px" class="center">
<img src="http://sportip.biz/nlsiplogo.jpg" alt="" border="0" />
</td>
</tr>
</table>
I think I am doing the in-line wrong.
I hope this is what you looking for:
<table style="background: url(sportip.biz/alpha.jpg)" border="0" cellpadding="0" cellspacing="0" align="left" class="deviceWidth">
<tr>
<td style="padding: 10px 20px" class="center">
<img src="http://sportip.biz/nlsiplogo.jpg" alt="" border="0" />
</td>
</tr>
</table>
<!-- End Logo -->
<!-- Nav -->
<table style="position: absolute; margin-top: 0; margin-left: 0;" border="0" cellpadding="0" cellspacing="0" align="right" class="deviceWidth">
<tr>
<td class="center" style="font-size: 13px; color: #272727; font-weight: light; text-align: right; font-family: Georgia, Times, serif; line-height: 20px; vertical-align: middle; padding:10px 20px; font-style:italic">
<b>Dear #name#,
Check out the latest releases of our magazines</b>
</td>
</tr>
</table>
Here's the fiddle.
jsfiddle.net/shanidkv/g0dd3vcm/1/
Find the updated JSfiddle code.
Note: Try to copy and past above url to browser facing some problem to attach link directly or on top of text
Many email clients do not support rendering a background image inside a table. See here for some examples of workarounds: http://blog.mailermailer.com/email-design/background-images-in-html-email-the-naked-truth
I am making an HTML Email and have decided to use tables for each of the nav elements. I need the tables to be displayed inline. I used display:inline-block; on the table creating the desired result,
However the TEXT inside the table will not align. I have placed the text-align: center; in the table, td, and a tag but it has not worked.
I know the method works with divs but I can't find a solution for tables.
HTML
<table width="100%" border="0" cellspacing="0" cellpadding="0">
<tr>
<td align="right" valign="top">
<table class="navInline" width="130" height="35" border="0" cellspacing="0" cellpadding="0" bgcolor="#999966" style="text-align:center;">
<tr>
<td align="center"> <a href="#" style="text-decoration: none; color: #005E82;">
option 1
</a>
</td>
</tr>
</table>
<table class="navInline" width="130" height="35" border="0" cellspacing="0" cellpadding="0" bgcolor="#999966">
<tr>
<td align="center" style="text-align:center;"> <a href="#" style="text-decoration: none; color: #005E82;">
option 2
</a>
</td>
</tr>
</table>
<table class="navInline" width="130" height="35" border="0" cellspacing="0" cellpadding="0" bgcolor="#999966">
<tr>
<td align="center"> <a href="#" style="text-decoration: none; color: #005E82; text-align:center;">
option 3
</a>
</td>
</tr>
</table>
</td>
</tr>
CSS
.navInline {
display:inline-block;
vertical-align:top;
text-align: center !important; }
here is the not working code
http://jsfiddle.net/nathanaric/pf35h/9/
You need to set a width attribute on your table cells.
Example:
<table class="navInline" width="130" height="35" border="0" cellspacing="0" cellpadding="0" bgcolor="#999966" style="text-align:center;">
<tr>
<td align="center" width="130">option 1</td>
</tr>
Can't say I agree with the chosen answer about adding width.
Your issue is the inline-block attribute. It's affecting all the user-agent defaults of the table child elements. Simply, replace display:inline-block with float:left and you get the same results with all the other css stlying falling into place. (text align e.g.)
.navInline {
float:left;
vertical-align:top;
text-align: center !important;
}
Here is a fiddle applying the new style.
http://jsfiddle.net/bdTUz/
BUT IMPORTANTLY... Your question states you are making an email template. Classes may not work. What I know from making html based emails, best practices are to add inline styles.
This link may be very helpful
http://htmlemailboilerplate.com/
I was able to resolve your issue using a list and not using any DIVs. It's much cleaner. Working code can be found in this JSFiddle:
HTML
<ul class="navInline">
<li>option1</li>
<li>option2</li>
<li>option3</li>
</ul>
CSS
.navInline li {
display:inline-block;
list-style:none;
border: 1px solid #333;
padding: 5px;
background-color: yellow;
}
I need curved bordered CSS for IE8 and all major browsers. currently I am trying with CSS PIE
jsfiddle demo is here. But I would suggest the answerers to download the PIE.htc file form here and try the HTML as a standalone page to get the real effect in IE8.
My problem is the <td> containing the "Thank you for registering" text is not curving in IE8 in jsfiddle. If I run it as a HTML page, it is curving in IE8 but the blue background is overlapping the "Thank you for registering" <td> (but its background is "#f2f2f2").
<table cellpadding="0" cellspacing="0" border="0" width="100%" style="margin:0px; padding:0px;">
<tr>
<td> </td>
<td style="width: 60%; text-align: center;background: #0067C8;">
<table cellpadding="0" cellspacing="0" border="0" width="100%">
<tr>
<td colspan="3" style="height: 50px; background-color: #262626; width:100%; text-align: left;">
<img src="twitter_logo.png" width="200" height="50" alt"Twitter" />
</td>
</tr>
<tr>
<td colspan="3" style="height: 25px;"> </td>
</tr>
<tr>
<td style="width:3%;"> </td>
<td style="width: 94%; background-color: #f2f2f2; height: 400px; font-family: arial; font-size: 30px; color: #2DB8ED; text-align: center; border: 2px solid #bcbcbc;text-align: center;-webkit-border-radius: 10px;-moz-border-radius: 10px;border-radius: 10px; behavior: url(PIE.htc);">
Thank you for registering
</td>
<td style="width:3%;"> </td>
</tr>
<tr>
<td colspan="3" style="height: 25px;"> </td>
</tr>
</table>
</td>
<td> </td>
</tr>
</table>
I think its mainly because of Problems with z-index.
Check here for more details. general issues encountered when using PIE
Have you tried, http://jquery.malsup.com/corner/ jquery plugin to add curves?
$(function () {
$('table table tr:eq(2) td:eq(1)').corner();
});
Demo : http://jsfiddle.net/bDvRd/4/
Try add
position:relative;
z-index: 0;
by Using CSS3Pie htc for border-radius in IE8
OR CSS3 PIE - Giving IE border-radius support not working?