I want a red border around my input text fields in a html form. But using css
input { border: 1px solid #d66 }
also puts a red border around my buttons (which I don't want).
input.button, input.submit or input.text and anything inside { } doesn't do anything.
How do I change the border around a text input only, and how do I change the font in the submit button only? I'm using IE9.
Thanks!
You can use the CSS border property to add a border around your HTML textboxes. You can also use border-width , border-style , and border-color , but the border property covers all of these anyway.
Set form content into fieldset (just after the form and before the /form), set Title into the fieldset, at the first line, and set a border (2px solid #000, for example) on the fieldset. Save this answer.
Styling Input Fields If you only want to style a specific input type, you can use attribute selectors: input[type=text] - will only select text fields. input[type=password] - will only select password fields. input[type=number] - will only select number fields.
To target textboxes, use
input[type="text"] { border: 1px solid #d66 }
There are a lot more attribute selectors available.
Have a look at http://css-tricks.com/attribute-selectors/
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