CSS多输入[类型]选择器

前端之家收集整理的这篇文章主要介绍了CSS多输入[类型]选择器前端之家小编觉得挺不错的,现在分享给大家,也给大家做个参考。
根据W3 ​​CSS规范,如:input [type〜=“text password”]应该选择类型设置为“text”或“password”的输入字段,但不起作用!我误解了这一行吗?

E[foo~=”warning”] Matches any E element whose “foo” attribute value is
a list of space-separated values,one of which is exactly equal to
“warning”.

CSS spec source,这是桌子底部的第四个。

解决方法

是的,你错了。选择器是在空格分隔列表中进行搜索,即

< element attribute =“text password”/>

你可以找到使用:

元素[属性〜= “文本”]

这样做的好处是它不应该匹配:

< element attribute =“textual password”/>

希望有帮助?

要实现你实际想做的是更详细一些:

输入[type =“text”],输入[type =“password”]

原文链接:https://www.f2er.com/css/218605.html

猜你在找的CSS相关文章