Link to home
Start Free TrialLog in
Avatar of Bob Hoffman
Bob HoffmanFlag for United States of America

asked on

How do I create a global CSS statement for all input fields on all my .aspx pages

Is there a way to define a global style that will cover all the input elements throughout my site? I don't want to have to assign the style to each element (ie cssClass=).

Something like: BODY {font-family: serif; background-color: silver;}  only to cover asp:textbox, asp:dropdownlist, etc.

tried INPUT.TEXT{ }.... this doesn't work

Thanks
Avatar of TonyReba
TonyReba
Flag of United States of America image

if you dont want to use a class,

input[type=button], input[type=submit]
{
width:auto;
padding:3px 6px;
color:#ffffff;
text-align:center;
background:#e2212a;
font-size:11px;
font-weight:bold;
border:0px;
margin:2px;
cursor:pointer;
-moz-border-radius: 5px;
-khtml-border-radius: 5px;
-webkit-border-radius: 5px;
border-radius: 5px;

}

Open in new window

ASKER CERTIFIED SOLUTION
Avatar of TonyReba
TonyReba
Flag of United States of America image

Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial
You can do it in 2 different ways, first method is to write css codes direct for input elements e.g.

input[type=text]
{
-moz-border-radius: 5px;
-khtml-border-radius: 5px;
-webkit-border-radius: 5px;
border-radius: 5px;
padding:4px;
font:12px;
}
in the above mentioned codes you are writing codes to apply directly on input type. and wherever you'll use in html <input type="text"............. /> these codes will automatically apply to all inputs.
But you can do the same thing in another way, first write a style class and then apply to the concerning elements e.g.
.textEntry
{
-moz-border-radius: 5px;
-khtml-border-radius: 5px;
-webkit-border-radius: 5px;
border-radius: 5px;
padding:4px;
font:12px;
}
now you have a class named 'textEntry' in your css and you can apply this class to the elements for example:
<input class="textEntry" type="text size="25" value="" />

hope this will be helpful to you.
Avatar of Bob Hoffman

ASKER

This did the trick... added "select" to handle the dropdown lists.

input, textarea, select {}

Thanks everyone.