Attribute selector where value equals either A or B?

CssCss Selectors

Css Problem Overview


I was wondering if it is possible to specify elements in CSS where an attribute is equal to one of two values, something like this:

input[type=text][type=password]

However this selector does not seem to work (I assume because specifying the same attribute twice is not valid), does anyone know how to do this?

Css Solutions


Solution 1 - Css

Like this? http://jsfiddle.net/m242t/

HTML:

<form>
Username: <input type="username" name="Username" value="Username" /><br />
Password: <input type="password" name="Password" value="Password" /><br />
<input type="submit" value="Submit" />
</form>

CSS:

input[type="username"], input[type="password"] {
    color: blue;
}

Attributions

All content for this solution is sourced from the original question on Stackoverflow.

The content on this page is licensed under the Attribution-ShareAlike 4.0 International (CC BY-SA 4.0) license.

Content TypeOriginal AuthorOriginal Content on Stackoverflow
QuestionAlex Hope O&#39;ConnorView Question on Stackoverflow
Solution 1 - CssngenView Answer on Stackoverflow