Given these HTML inputs of differing types:
<input type="text" id="username" />
<input type="email" id="emailaddress" />
<input type="date" id="birthday" />
<input type="password" id="pword" />
<input type="search" id="q" />
Is it possible to apply CSS styles to all text boxes without having to either add a class to each or selecting them like this:
input[type="text"],
input[type="email"],
input[type="date"],
input[type="password"],
input[type="search"]
...
Also I don’t want to use input { } as that would select radio buttons etc. when I only want to style are the text boxes.
I don’t think this is possible. For instance, it’s up to the browser to decide how an input is rendered. There’s no way to query how the browser has rendered a control (as far as I know).
For example, some browsers will render a ‘range’ input as as textbox rather than a slider. Also some browsers render the ‘search’ control differently to other text boxes (rounded corners etc), so your CSS may not work as you expect anyway.
I think you’ll have to go for the input[type=”text”], input=[type=”password”] { } rules as you described.