CSS:多属性选择器 [英] CSS: Multiple Attribute Selectors
问题描述
我想对类型为email和password的表单输入进行样式化,而不是其他任何内容。我在想象下面的东西:
input [type =email] [type =password] {
....
}
然而,属性选择器的工作方式将其解释为类型同时是电子邮件和密码的输入。我要做的是输入,其中类型是完全电子邮件或密码。当然,同时没有类型电子邮件和类型密码。
可以写一个CSS规则或
<$ p <$ p <$ p <$ p < >< form id =loginonsubmit =return fadeaway()>
< fieldset>
< input type =emailplaceholder =username/> < br />
< input type =passwordplaceholder =password/> < br />
< / fieldset>
< / form>
只要这样做:
输入[type =email],输入[type =password]
I would like to style form inputs of type "email" and "password", but not anything else. I was imagining something like the following:
input[type="email"][type="password"] {
....
}
However, the way attribute selectors work, it appears to interpret this as "input where the type is simultaneously both 'email' and 'password'". What I'm going for is "input where the type is either exactly 'email' or 'password'". Of course, nothing is both of type email and of type password at the same time.
Is it possible to write a CSS rule that or's across multiple different attribute selectors?
For reference, the HTML would look something like:
<form id="login" onsubmit="return fadeaway()">
<fieldset>
<input type="email" placeholder="username"/> <br />
<input type="password" placeholder="password"/> <br />
</fieldset>
</form>
Just do this:
input[type="email"], input[type="password"]
这篇关于CSS:多属性选择器的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!