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!

Forms and Stylesheets

Status
Not open for further replies.

Inssider

Technical User
Aug 24, 2000
49
0
0
US
How can I set a separate and global style for different types of form inputs? For instance, a separate one for <INPUT type=checkbox> and <INPUT type=password>. I'd rather not have to go back through all my webpages and stick a class=checkboxform for all my different types of form inputs...

INPUT{
color:#FFFFFF;border-width:2px;border-style:solid;background-color:#333333;
border-top-color:#CCCCCC;border-left-color:#CCCCCC;border-bottom-color:#505050;border-right-color:#505050;
font-weight:bold;font-size:10pt;font-family:&quot;times new roman&quot;;}

That works fine for one type of inputs (in this case, submit buttons) but I want a different one for <INPUT type=text>

Thanks
 
the question has been asked a few days ago
perform a search as i don't remember the exact answer (was something like : weeeellllll, not EXACTLY, but you can either add a class/id &quot;by hand&quot; to every input, or use a jscript function that will add the class/id to each xxx tag) -
 
To the best of my knowledge, it cannot be done without adding (whether by hand or dynamically) class or id to the <INPUT> tag. Kevin
slanek@ssd.fsi.com
 
CSS2 I think will support it like this:

<STYLE type=&quot;text/css&quot;>
INPUT[type=&quot;password&quot;]
{
color: #ff0000;
}
INPUT[type=&quot;text&quot;]
{
color: #ffff00;
}
</STYLE>

But I don't what browsers support them. Sorry! As you can see depending on what attribute the INPUT has sets the Style. It's called attribute selectors have a look at for more
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top