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

Can I apply a style to all elements of a type?

Status
Not open for further replies.

rhowes

IS-IT--Management
Jun 6, 2001
140
ZA
Hi

Can I apply a style to all elements of a type, for example an INPUT text box? At the moment I type

<input type=&quot;text&quot; style=&quot;...

for every input box which is a major headache and maintenance nightmare.

Thanks in advance for any assistance.

Regards
Richard
 
<style>
INPUT {background-color:eek:range;}
</style>

Simple as that.

Cheers,

Tom
 
Hi Richard,

You can make a cascading style sheet (CSS)

1)Write this code in a &quot;notepad&quot;-file
INPUT.textbox
{
BACKGROUND-COLOR: yellow
}

and save the file as &quot;yourfilename.css&quot; :

2)put this in your <head></head>:
<link rel=&quot;stylesheet&quot; href=&quot;yourfilename.css&quot; type=&quot;text/css&quot;>

3)write this in your <body></body>
<input type=&quot;text&quot; class=&quot;textbox&quot;>

Hope this helps,
Erik
 
You can apply a style to only input text boxes without having to use any of that class stuff....using CSS2 selectors

input[type=&quot;text&quot;] {

/*style here*/

}

only works in Netscape 6.x/ Mozilla and maybe Konqeror (spelling) tho....its CSS2 so MAYBE IE will support it in there next version. (Why the heck wasn't it in IE6 is waht I am wondering.)

===
Supports Mozilla and Web Standards
Knows HTML/XHTML, CSS1, JavaScript, PHP, C++, DOM1
===
 
Hi All

Thank you very much for all your help. I have been developing a site using PHP, and my HTML (including style sheets) is very shaky.

Thanks again for all your help.
Cheers

Richard
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top