【发布时间】:2011-12-07 19:56:27
【问题描述】:
在这里有一个金发碧眼的时刻,尝试使用 CSS 告诉分隔器在输入获得焦点后更改其背景。
<p>
<label>Your Name</label>
<input type="text" name="your_name" id="your_name" value="" />
<div class="formhelper">Please enter your full name,<br />Character limit of 255</div>
</p>
这是 HTML 代码,现在我已经尝试了以下但无法让它工作
.appformwrapper input:focus + div {
background-color: #CCC !important;
display: block;
}
.appformwrapper div ~ input:focus {
background-color: #CCC !important;
}
.appformwrapper input:focus {
background-color: #EEF;
}
有什么想法吗?我以前在 CSS 中做过一次,但找不到我爆破的代码:(
【问题讨论】:
标签: html css css-selectors