D_R
D_R

Reputation: 4962

How can i add "focus" directly by the style tag in html?

How can i add "focus" directly by the style tag in html? for ex: (I cant use stylesheet or javascript for this issue, since its inside mail) HTML Code:

<a href="#" style="a:focus { border: 1px solid #000; }">CLICK ME TO SEE THE BOUNDRIES</a>

Upvotes: 9

Views: 13718

Answers (3)

Gurvinder
Gurvinder

Reputation: 790

I think its not possible without using JS and CSS.For reference you can go through this link

How to write a:hover in inline CSS?

And you can define style tag in mail content body.

Upvotes: 0

Dau
Dau

Reputation: 8858

use <style type="text/css"> tag

<style type="text/css">
a.hover{
/*your style here*/
}
</style>

or if you want to give style to this particular anchor tag then give the id to this anchor and use

<style type="text/css">
#<anchor id>:hover{
/*your style here*/
}
</style> 

Upvotes: 0

Purag
Purag

Reputation: 17061

According to this guide to CSS in emails, you have the ability to use <style> tags in the email, but this method is not supported at all by either GMail (both browser and mobile versions).

That being said, there is little to no support for the hover, visited, and focus selectors on any client.

I understand completely that cross-client incompatibility may not be a worthwhile compromise, but just know that this option is out there.

Upvotes: 1

Related Questions