Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

input[type="submit"] - change background when clicked

I have a simple <input type="submit" value="Search"> submit button. In the CSS i have styled it with input[type="submit"] and input[type="submit"]:hover so it changes its background by default and when hovered. Is there a way to change its background when clicked?

like image 745
stevereds Avatar asked Dec 03 '22 12:12

stevereds


2 Answers

You should be able to use input[type=submit]:active, similar to how you'd style links.

Do note that this will not function properly in IE6 (not sure about 7 and 8)

like image 100
Jani Hartikainen Avatar answered Jan 04 '23 01:01

Jani Hartikainen


input[type="submit"]:active {
    color: green;
}
like image 45
Matty F Avatar answered Jan 04 '23 01:01

Matty F