html - <a> tag nested with a <table> tag is not valid in XHTML -
i coding html
email template. want make legal under xhtml
rules. there button in code made <table>
tag , linked, of course, url. reason added <a>
tag before <table>
. w3c validator tool says cannot nest these elements. added code make more understandable.
do have suggestion avoid issue?
i appreciate help.
<a style="text-decoration:none; color:#660eaa; font-size:13px; line-height:125%;" href="http://google.com/" target="_blank" > <table id="templatebutton" style="font-size:15px; border-radius:6px; -moz-border-radius:6px; -webkit-border-radius:6px;" bgcolor="#ffd700" align="center" cellspacing="0" cellpadding="0" border="0"> <tr> <td align="center" style="padding:16px 10px"><strong>go google!</strong></td> </tr> </table> </a>
you can't use a
tag this.
the proper way is:
<table id="templatebutton" style="font-size:15px; border-radius:6px; -moz-border-radius:6px; -webkit-border-radius:6px;" bgcolor="#ffd700" align="center" cellspacing="0" cellpadding="0" border="0"> <tr> <td align="center" style="padding:16px 10px"> <a style="text-decoration:none; color:#660eaa; font-size:13px; line-height:125%;" href="http://google.com/" target="_blank" ><strong>go google!</strong></a> </td> </tr> </table>
you style a
tag button, not containers (td
or table
)
also, make sure html email going same or similar in email clients want support. example border-radius have set, not work in lot of email clients.
i encourage check out site more information regarding html email: https://www.campaignmonitor.com/dev-resources/will-it-work/
edit: can style table
, td
adding background color.
Comments
Post a Comment