使用CSS匹配空输入框 [英] Matching an empty input box using CSS
本文介绍了使用CSS匹配空输入框的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
如何将样式应用于空输入框?如果用户在输入字段中键入内容,则不应再应用该样式。这是可能在CSS吗?我尝试过:
How do I apply a style to an empty input box? If the user types something in the input field, the style should no longer be applied. Is this possible in CSS? I tried this:
input[value=""]
推荐答案
CSS中没有选择器。属性选择器匹配属性值,而不是计算值。
There is no selector in CSS which does this. Attribute selectors match attribute values, not computed values.
您必须使用JavaScript。
You would have to use JavaScript.
这篇关于使用CSS匹配空输入框的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!
查看全文