你可以使用CSS对活动表单输入的标签进行样式化 [英] Can you style an active form input's label with just CSS
本文介绍了你可以使用CSS对活动表单输入的标签进行样式化的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
提供以下html
<label for="inputelement">label</label>
<input type="text" id="inputelement" name="inputelement" />
您可以使用
input:focus { background: green; }
是否还有一种方式为< label /
Is there a way of also styling the <label />
without JavaScript?
感谢所有
推荐答案
p>否。有不幸的是在css中没有前置选择器
No. there is unfortunately no predecessor selector in css
input:focus -+ label { ... }
将是可爱的。
:
input:focus + label { ... }
您可以使用一些位置显示之前...
you could use some positioning to display before...
这篇关于你可以使用CSS对活动表单输入的标签进行样式化的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!
查看全文