When I was trying to add some input fields with css
I got a problem
I couldn't make more than one css for some input fields
this is the fields I have
<input type="text" name="firstName" />
<input type="text" name="lastName" />
and the css is
input
{
background-image:url('images/fieldBG.gif');
background-repeat:repeat-x;
border: 0px solid;
height:25px;
width:235px;
}
I want to make the first field (firstName) with this css
input
{
background-image:url('images/fieldBG.gif');
background-repeat:repeat-x;
border: 0px solid;
height:25px;
width:235px;
}
and the second one (lastName) with this css
input
{
background-image:url('images/fieldBG2222.gif');
background-repeat:repeat-x;
border: 0px solid;
height:25px;
width:125px;
}
help please :-)
Use Classes to style. they are a better solution. using classes you can style each input type individually.
Add an 'id' tag to each of your inputs:
then you can use the #selector in CSS to grab each one.
You have to change your HTML file:
...to:
And modify your CSS file to:
Best of Luck!
Use the ID selector.
CSS:
HTML:
All your inputs will be styled with the generic input style, and the two special ones will have the styling specified by the ID selector.
You can style by type or name the form elements using CSS.