How to style just one type of input field without also affecting other input types with CSS
- by James
Is there a way to write style rules that will only influence text fields. Suppose I have the following:
<div id="helloDiv">
<input type="text" name="something" /><br />
<input type="checkbox" name="somethingElse" /><br />
<input type="submit" name="go" />
</div>
div#helloDiv input {
border: 1px solid red;
}
The problem with the above CSS rule is that it will affect ALL input fields not just input text but also radio buttons, submit buttons, etc.
So is there a cross browser solution to affect just one type of input field within a div or other page element (without resorting to assigning the input fields styles individually).