Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations SkipVought on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

affecting specific tag from external CSS 1

Status
Not open for further replies.

Davide77

Technical User
Mar 6, 2003
166
0
0
CH
Hallo,

I have a form with some <input type="text> and one submit button. I would like to use a background image for the text-input but I don't want to use the same image for the button. The problem is that they use the same tag <input..> and an external CSS will affect all of them.
I have to use external CSSs because they are loaded depending on the browser.
I tried to modify the button with an internal style definition but the problem is how to remove the background image and make the button look like a normal button. Do you have any ideas?

thanks
Davide
 
Use classes - input.text and input.button - which should allow you to specify different backgrounds for each.
 
There's no way to do this in CSS1. Later versions of CSS do allow you to select on the basis of attribute values:
Code:
input[type="submit"] { ... }
Unfortunately, many browsers - notably IE - do not recognise attribute selectors.

So mattygriff's right, you need to use classes, but (s)he fails to point out that you need to declare the class in your html where you want to use them, i.e.
Code:
<input class="text" name="my_name" />
<input class="button" type="submit" value=" OK " />

-- Chris Hunt
 
thanks ChrisHunt, that's what I needed to know
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top