Welcome to ShenZhenJia Knowledge Sharing Community for programmer and developer-Open, Learning and Share
menu search
person
Welcome To Ask or Share your Answers For Others

Categories

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?

See Question&Answers more detail:os

与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
thumb_up_alt 0 like thumb_down_alt 0 dislike
409 views
Welcome To Ask or Share your Answers For Others

1 Answer

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;
}

与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
thumb_up_alt 0 like thumb_down_alt 0 dislike
Welcome to ShenZhenJia Knowledge Sharing Community for programmer and developer-Open, Learning and Share
...