Is there any option, or special selector to change the style for a pressed button, what I mean by that..when a user clicks a button I want to change the style for that button? Is there any option to do that like: :focus
or only with javascript click/focus event?
views:
32answers:
1
+4
A:
I think you are looking for the :active
pseudo-class...
<!DOCTYPE html>
<html>
<head>
<style type="text/css">
#btn { border: solid 5px red; padding: 5px; }
#btn:hover { border-color: green; }
#btn:active { border-color: blue; }
</style>
</head>
<body>
<input id="btn" type="submit" />
</body>
</html>
Note: if you are using both :hover
and :active
on a single element, the :hover
definition must come first.
Josh Stodola
2010-07-21 15:43:40
Yup! thx a lot man
Uffo
2010-07-21 15:47:12