/    Sign up×
Community /Pin to ProfileBookmark

<a> tag syntax

There was an issue I use to run into pretty often when I wanted to add rollover effects to links. Sometimes they would work and other times they wouldn’t.

Turns out the reason was due to the order of the (link, visited, hover, and active) states.

If you do not have them in the proper oder they will not work. The only reason that I could get them to work sometimes is because I would just get lucky.

An easy way to remember the proper order is LoVe HAte
L=link
V=visited
H=hover
A=active

Here is an example of the proper way to stack the css code:
navlink:link{color=#ff0000}
navlink:visited{color=#ffff00}
navlink:hover{color=#0000ff}
navlink:active{color=#ff0000}

If you stack these in any other order the effects will not be predictable.

I hope this helps!

to post a comment
CSS

1 Comments(s)

Copy linkTweet thisAlerts:
@The_Little_GuyMay 07.2006 — your CSS code is wrong. There are no equal signs in CSS

navlink:link{color:#ff0000}

navlink:visited{color:#ffff00}

navlink:hover{color:#0000ff}

navlink:active{color:#ff0000}

I would also reccomend adding an [B]a[/B] before [I]navlink[/I], or whatever you want your class name to be.

a.navlink:link{color:#ff0000}

a.navlink:visited{color:#ffff00}

a.navlink:hover{color:#0000ff}

a.navlink:active{color:#ff0000}
×

Success!

Help @dogznbonz 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 6.17,
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: @nearjob,
tipped: article
amount: 1000 SATS,

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

tipper: @meenaratha,
tipped: article
amount: 1000 SATS,
)...