/    Sign up×
Community /Pin to ProfileBookmark

can we set hover and visited inside a link tag?

Can I set link attributes -hover and visited – inside a link tag for example:

<A HREF=’something.htm’ STYLE=’hover:Underline;’>

well the above didn’t work for me. is there another way?

Thanks.

to post a comment
CSS

6 Comments(s)

Copy linkTweet thisAlerts:
@Daniel_TMar 18.2005 — Sorry, but it's impossible. You could do it with JavaScript, but it probably wouldn't be worth it ?
Copy linkTweet thisAlerts:
@amahmoodauthorMar 18.2005 — Thanks.
Copy linkTweet thisAlerts:
@bathurst_guyApr 01.2005 — can i ask why you may want to do this anyway? one of the great things about css is that you only have to update one linked stylesheet and all of your pages are updated, adding the styles individually into each link would be such a pain in the butt!!!

All I can think at the moment what your trying to do is have different links have different colours when they are hovered. This is possible if thats the case. Just create a different class in your stylesheet for each type, then in the body give each link its class.
Copy linkTweet thisAlerts:
@NogDogApr 01.2005 — Give the link a class...
<i>
</i>&lt;a href="link.html" class=special&gt;link text&lt;/a&gt;

...and in your style section or stylesheet include...
<i>
</i>a.special {
// attributes common to all "special" links here
}
a.special:visited {
// attributes unique to visited "special" links
}
a.special:hover, a.special:active {
// attributes unique to "special" hover and active links
}
Copy linkTweet thisAlerts:
@stingermanMay 30.2009 — Found this through google as I was wondering the same.

I made my website which has numerous css style sheets and different pages.

However, I didn't make a separate external style sheet for the sidebar (which I update via php include). I messed up there, lol!

I was wondering if I could put the active, hover, link colors in the div style (html not css) Guess not. ?

Further more, you can't put an external style sheet link in the body can you - because then I could just add it to the sidebar php include file?
Copy linkTweet thisAlerts:
@StripedHoodieJun 16.2010 — There are still some practical applications. For example, HTML email.

Almost all web based email clients will strip out the <head> tag and everything inside of it. This is so it doesn't interfere with the site design. This rules out external style sheets as well as embedding classes with the <style> tag.

So, for example, every tag needs to have it's own style defined:

Good: <a href="#" style="color:#000000;"></a>

Bad: <a href="#" class="SomeClass"></a>

I think being able to include ":hover" would of been a great addition to CSS when it first started out. Then as more revisions were drafted slowly phase it out - because I agree, it's a terrible way to regularly code. However, all these mail clients have thier own way of displaying HTML Email and this is the only way to display a message compatible with all clients.
×

Success!

Help @amahmood spread the word by sharing this article on Twitter...

Tweet This
Sign in
Forgot password?
Sign in with TwitchSign in with GithubCreate Account
about: ({
version: 0.1.9 BETA 5.29,
whats_new: community page,
up_next: more Davinci•003 tasks,
coming_soon: events calendar,
social: @webDeveloperHQ
});

legal: ({
terms: of use,
privacy: policy
});
changelog: (
version: 0.1.9,
notes: added community page

version: 0.1.8,
notes: added Davinci•003

version: 0.1.7,
notes: upvote answers to bounties

version: 0.1.6,
notes: article editor refresh
)...
recent_tips: (
tipper: @AriseFacilitySolutions09,
tipped: article
amount: 1000 SATS,

tipper: @Yussuf4331,
tipped: article
amount: 1000 SATS,

tipper: @darkwebsites540,
tipped: article
amount: 10 SATS,
)...