2 replies [Last post]
mAdMaLuDaWg
Offline
newbie
Last seen: 18 years 15 weeks ago
Joined: 2004-08-17
Posts: 3
Points: 0

Hello,
I'm designing a menu for my website. I have arranged my links using :

a {display:block};
a:hover {color:red; background:white...};

The CSS works fine, however, I want to have an additional state change when the user clicks the link. Is there a way to do this in CSS? Or do I have to use javascript like:
<a href="..." onmousedown="changeCSSClass()";>

TIA.

Stu
Stu's picture
Offline
Enthusiast
Bristol uk
Last seen: 18 years 45 weeks ago
Bristol uk
Joined: 2004-01-20
Posts: 282
Points: 0

Is there a way to change the attributes of a link on click?

Use a:active for IE and a:focus for FF etc.

You can see this in action here
http://www.stunicholls.myby.co.uk/menu/scroll_gallery.html

It's not what you do it's the way that you do it.
So do it with STYLE
http://www.s7u.co.uk

mAdMaLuDaWg
Offline
newbie
Last seen: 18 years 15 weeks ago
Joined: 2004-08-17
Posts: 3
Points: 0

Is there a way to change the attributes of a link on click?

Thanks, I didn't know about the active tag. Thats a nifty feature!
However, what I was hoping for was the attribute to temporarily remain there, that is, I click the link and it turns to a different color and when I let go of the mouse button, it turns back. In other words, I just need the color to be changed during the onmousedown event.
Is this possible with stylesheets?