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 :-)
No. CSS is a presentation language. It cannot be used to alter the semantics and structure of a document.
CSS can be added to HTML documents in 3 ways: Inline - by using the style attribute inside HTML elements. Internal - by using a <style> element in the <head> section. External - by using a <link> element to link to an external CSS file.
CSS attribute selector is used to targeting an input text fields. The input text fields of type 'text' can be targeting by using input[type=text].
CSS form is used to create interactive forms for users and provides many ways to set the style. There are many CSS properties available that can be used to create and style HTML forms to make them more interactive.
You can style by type or name the form elements using CSS.
input[type=text] {
//styling
}
input[name=html_name] {
//styling
}
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With