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 derfloh on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

CSS for different <input> types?

Status
Not open for further replies.

wmd3

Programmer
Jan 22, 2002
37
US
Is there any way I can define a different Style Sheet for Input tags with different types?

(Example: <input type=text> <input type=button> )

I have standards on my web site that say the background should be one color, textboxes another color, and buttons another color.

Is there an easy way to do this, without having to assign a class to each element?

Thanks in advance!
 
Basically, the current CSS standards do not distinguish between input types. That means your best bet are still classes. If you have many input boxes that will use similar formatting grouped together, you could embed them in a div and use that for formatting:

<style>
.textboxes input { your style here }
</style>

<div class=&quot;textboxes&quot;>
lots of <input type=&quot;text&quot; ... />
</div>

That is about it.
 
you can use pusedo classes

input.one {styles}
input.two {styles}

<input class=&quot;one&quot;>
<input class=&quot;two&quot;>

each will look different.

at least in IE -- NN isnt quite as forgiving with this

<Signature>
Sometimes the Answer You Are LOOKING for can be FOUND BY SEARCHING THE FAQ'S @&%$*#!!!
</Signature>
 
I have found some examples of...

<style>
input[type=button] {...}
</style>

But, I can't get this to work either. :(

Any other ideas?
 
they work for me -- but i dont understand input[type=button] {...}

never seen that before

<Signature>
Sometimes the Answer You Are LOOKING for can be FOUND BY SEARCHING THE FAQ'S @&%$*#!!!
</Signature>
 
This syntax is part of the W3C CSS2 standards. Since it is revision 2 it is clearly that browsers are lacking the support. While you might get something like this to work in a latest Opera browser, it probably won't be part of the &quot;IE standards&quot; for a while. Either wait five years or use one of the methods explained above.
 
Vragabond, you sais it's a part of CSS specification. Would you give a link to the page with descripion of it? I've never seen anything like this in CSS spec...

Good Luck! :)
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top