How to apply the same attributes to multiple elements

windows

Guest
Hi I want to know how do I define the same properties for different elements
eg. How do I define the same properties for the following elements in FORM > INPUT and then in submit, reset and button.

FORM > INPUT [type = submit]{
background : #FFFFFF;
border : 1px solid #000000;
}

so how do I tweak it to apply the same attributes to reset and button as well.just make a class like so:

.JoClassName {
background : #FFFFFF;
border : 1px solid #000000;
}

and apply it to whatever you wish...I knew that already but I didn't want to do that because my CSS file is external and it is default for my entire-site hence I wanted to set a host of default attributes to>JDM71488
07-04-2005, 10:33 AM

if you want a standard just do a general one like this:

input {
background : #FFFFFF;
border : 1px solid #000000;
}

the background on all of your textboxes are white anyways (unless you changed them) and the border on them will match your buttons now...I knew that already but I didn't want to do that because my CSS file is external and it is default for my entire-site hence I wanted to set a host of default attributes to only specified elements. However I have found the solution to it.
It is as follows
FORM > INPUT [type = submit],[type=button],[type=reset]
{
background : #FFFFFF;
border : 1px solid #000000;
}

this sets up multiple elements with the same set of attributes.
Hey by the way I am 15 yrs old. I read a post of a 12yrs old who's learning PHP and has even sent a mail through his script!!
that's the strangest piece of css I've ever seen... O__o
I can tell you from experience, IE doesn't understand the element > element stuff.

as Jeremy pointed out, you can do a general thing for input.
If you want to be more specific, you can do that :

.forminput
{
background : #FFFFFF;
border : 1px solid #000000;
}

and then, add that to all the inputs you want to look like that...

But it's true, inputs are in forms, so no need to specify that anyway.true on implying form, but i always put specify the element to which my id is defined to be explicit... (ex: div#content versus #content) why idk? but it really doesn't matter... can't go wrong with explicitly defining things...true on implying form, but i always put specify the element to which my id is defined to be explicit... (ex: div#content versus #content) why idk? but it really doesn't matter... can't go wrong with explicitly defining things...
true !!!
But I like simple things...

What I usually do ( as if somebody cared about what I do ) is set a whole bunch of classes, and couple them...

like :
.border {
some border properties here
}

.background {
some background properties here
}

.small {
font-size: small;
}

and then, I just do :
<p class="small border">blablabla</p>
<p class="border background">text with a background and a border... </p>

It's so much easier to have everything at hand !!!

BTW, sorry for repeating what you had said about the classes, Jeremy. I didn't even see that you already proposed a class solution. I must have seemed very stupid in here... ;)
 
Back
Top