3 replies [Last post]
tzug
Offline
Regular
Last seen: 18 years 35 weeks ago
Joined: 2004-09-28
Posts: 21
Points: 0

hi
i am not a newbie to css but have a question:
i want that in ALL my document ALL the input boxes will have a background color on "ONFOCUS" !

can i do it with css or do i have to put the "ONFOCUS" on every input tag ?

i tried :
input { onfocus: background-color: black }

and:
input:onfucos { background-color: black }

NONE WORKS

benny
Offline
Enthusiast
Last seen: 15 years 33 weeks ago
Joined: 2004-08-24
Posts: 64
Points: 0

how to do this ?

Hi,

i think onFocus is not a css pseudo element but javascript, so you need to write it in every tag...
greets
ben

tzug
Offline
Regular
Last seen: 18 years 35 weeks ago
Joined: 2004-09-28
Posts: 21
Points: 0

how to do this ?

Sad
those were my thoughts too,
anybody knows a css solution ?

Tony
Tony's picture
Offline
Moderator
Brisbane
Last seen: 3 weeks 4 days ago
Brisbane
Timezone: GMT+10
Joined: 2003-03-12
Posts: 5344
Points: 2965

how to do this ?

Hi tzug,
You could use

input{background-color:red;} 
input:hover{background-color:green;} 
input:focus{background-color:blue;}
Unfortunately it wont work in IE.


Hope that helps