Is there a way to select multiple input field types with CSS?

后端 未结 1 710
北海茫月
北海茫月 2021-02-03 18:45

I have a text and a password input field that I\'m trying to select in this fashion:

input[type=text][type=password]

however this does not work

相关标签:
1条回答
  • 2021-02-03 19:30

    You need to specify the attributes separately, repeating the types if necessary and using comma(s):

    input[type=text], input[type=password]
    

    Your given selector is trying to match an input with a type that is both text and password, but a single element can't have different values for the same attribute so it fails.

    0 讨论(0)
提交回复
热议问题