开发者

Is there a way to set an inline style on an href link on "a:hover" in a html email?

开发者 https://www.devze.com 2023-01-01 06:06 出处:网络
The question is to know if there is a way to build an HTML email with 开发者_Go百科inline style (no CSS file, nor <style> tags) with the href links that react with the mouse passing over them :

The question is to know if there is a way to build an HTML email with 开发者_Go百科inline style (no CSS file, nor <style> tags) with the href links that react with the mouse passing over them : just to be able to change the color font.

So, no JS, no script, no <style>, just <a href="http://www.dot.com style="....">link</a>


The normal HTML way for inline styling is:

<a href="url" style="color:#cfe7fe";">Click me!</a>

But I am not sure how reliable that is in email templates.

You could always try: (Although deprecated)

<font color="blue"> <a href="url">Click me!</a> </font>

Hope it helps.

Edit: For inline hover try using:

onmouseover="this.style.color='blue';" 
onmouseout="this.style.color='black';"

But again I am not sure on email support for this.


No.

You can't apply pesudo-classes (or anything else that appears in a selector) via the style attribute.


Some E-Mail clients support style tags, and thus the defining of pseudo-selectors. According to this list:

Guide to CSS support in E-Mail clients

:hover is supported by a good number of clients.

You should be able to slip a <style> tag into the body if necessary. That's not valid, but rich E-Mails are such a minefield that that is going to hardly matter.

:hover is your only chance I think. It's not possible to define pseudo-selectors inline, and JavaScript is out because it's going to be blocked by most (or all?) clients.


You can, however, you will not be able to change the color of the underline. You can wrap the the link text in a div and then wrap the div in a link, like this:

<a href="http://www.google.com"><div style="margin: 0px;padding: 20px 50px;font-size: 50px; color: red;">GOOGLE</div></a>

The word "GOOGLE" will appear red, but with a blue underline. So that does not exactly solve your problem, I don't think.

0

精彩评论

暂无评论...
验证码 换一张
取 消