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

Same color for all text elements

Status
Not open for further replies.

robi2

Programmer
Jan 19, 2003
62
IL
Hi, is there some command in css that will make all the text fields in on my page the same color or something like that.

I mean:
<style type=&quot;text/css&quot;>
some commands here
</style>

...

<input type=&quot;text&quot; name=&quot;text1&quot;>

<input type=&quot;text&quot; name=&quot;text2&quot;>


I would like the two text fields to be the same color.
And i do not want to assign class or style propreties to them individually.

Thanks.
 
input{ color: #ff0000; } &quot;I've found your posts in this thread to be mostly childish and immaterial&quot; - sleipnir214 about me - 12 Feb '03

-pete
 
that would make all of my input elements be that color...
i only want the text fields...
 
>> i only want the text fields...

oh.. then assign a class 2 ur input element..

.mytextbox{ color: #ff0000 }

<input class=&quot;mytextbox&quot; ... > &quot;if ur going to get flamed... u may as well post something flame worthy eh?&quot; - me - 12 Feb '03

-pete
 
I wrote that i would not want to assign a class object to all of my text fields...

But i guess there is no other way...
 
>> I wrote that i would not want to assign a class object
>> to all of my text fields...

oops... sorry i lost that part.

>> But i guess there is no other way

maybe not. just curious why do you not want to use the &quot;class&quot; attribute?

-pete
 
Well id like to palce text boxes dynamically using asp, and change te design dynamically also using asp...

This way whenever i want to change the desing, the colors, i just change the css and all of the page gets updated, class does similar things but i would need to add it to each and every text field...
 
so if ur building all those elements dynamically then it not a problem putting in the &quot;class&quot; attributes since ur ASP code that generates the <input> element only exists in one place right?

-pete
 
actually you can select only text input elements using CSS2. Unfortutionately, legacy browsers, such as IE6, don't support these selectors.

Luckly, they do work in gecko based browsers, and opera as well I think.

The code would be...

input[type=&quot;text&quot;] {
color:blue;
background-color:white;
etc...
} ===
Supports Mozilla and Web Standards
Knows HTML/XHTML, CSS1, JavaScript, PHP, C++, DOM1
===
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top