4 replies [Last post]
liquidz2k
Offline
Regular
Last seen: 5 years 44 weeks ago
Joined: 2006-09-17
Posts: 28
Points: 0

I tried searching google and here for this, but I find everything else except it...

What I want to do is specify the background color for all the html buttons on the website. You know input type="button" or type="submit" ?

However when I use the css:

input {background-color:#FF0000;} 

This changes the color of my text fields too, is there a way to specify for the input just to make it apply to buttons, or do I need to simply make a button class and specify it on all the buttons?

Thanks,

Hugo
Hugo's picture
Offline
Moderator
London
Last seen: 3 days 21 hours ago
London
Joined: 2004-06-06
Posts: 15667
Points: 2805

In theory you could use an

In theory you could use an attribute selector, in reality probably simplest to use a class if you want this to work cross browwser, you could also script it based on attribute.

Before you make your first post it is vital that you READ THE POSTING GUIDELINES!
----------------------------------------------------------------
Please post ALL your code - both CSS & HTML - in [code] tags
Please validate and ensure you have included a full Doctype before posting.
Why validate? Read Me

liquidz2k
Offline
Regular
Last seen: 5 years 44 weeks ago
Joined: 2006-09-17
Posts: 28
Points: 0

I believe firefox3 has

I believe firefox3 has support for attribute selectors however I had no luck there with it. I am going to just use classes for compatibility, but still would like to know how to do this with selectors, I think I am trying to use the wrong child maybe. :shrug:

manrilla
manrilla's picture
Offline
Enthusiast
Philadelphia
Last seen: 4 years 34 weeks ago
Philadelphia
Timezone: GMT-4
Joined: 2005-02-04
Posts: 56
Points: 3

Image Replacement?

Wouldn't it just be better to make a button? Then you could choose your color/font you want as well.

"Waking a half mat. Sleeping, one mat. Rule the nation, a fistful of rice."

Marc Manley.com
http://www.marcmanley.com/

Hugo
Hugo's picture
Offline
Moderator
London
Last seen: 3 days 21 hours ago
London
Joined: 2004-06-06
Posts: 15667
Points: 2805

Yes if this is an input

Yes if this is an input type=submit then perhaps the button tag with img tag is the best approach

Before you make your first post it is vital that you READ THE POSTING GUIDELINES!
----------------------------------------------------------------
Please post ALL your code - both CSS & HTML - in [code] tags
Please validate and ensure you have included a full Doctype before posting.
Why validate? Read Me