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

css input box style

Status
Not open for further replies.

tomvdduin

Programmer
Sep 29, 2002
155
NL
Hi,

I want to give the text boxes on my site the same look. When using the Input selector, all elements that are inputs, such as a button, has the same look.

I tried the selector Input Text, although it doesn't exist, if it works, but no.

Is it possible to give only the textboxes the same css, without a class?
 
The css standard is:
Code:
input[COLOR=red][type="text"][/color] {color:#39c;}

works fine in moz; bit of a non-starter in IE.

NB: For this code to work, you HAVE to specify type="text" in your html (even though the default type for an input is text): e.g.
Code:
<input [COLOR=red]type="text"[/color] name="input1" id="input1" />

<marc> i wonder what will happen if i press this...[ul][li]please tell us if our suggestion has helped[/li][li]need some help? faq581-3339[/li][/ul]
 
OK, thanks Manarth, I've searched, but couldn't find it. I haven't done a lot of things with css...
 
Is there no solution for IE? I guess that most of my users uses IE, so...

If not, I'm going to use a class
 
Would something like this help you?:

Code:
var allInputs = document.getElementsByTagName("INPUT");
for(var i=0; i<allInputs.length; i++)
{
 if(allInputs[i].type == "text")
 {
  allInputs[i].style.whatever = something;
  ...
 }
}

I have used this sort of technique to disable all my text fields at once, but never to adjust their style.

Good luck!

--Dave
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top