我正在尝试将 css 应用于此 ftl 片段:
<@spring.formInput "customer.email" />
我使用的 CSS 是:
.card.alt .input-container input {
color: #ffffff;
}
.card.alt .input-container input:focus ~ label {
color: #ffffff;
}
.card.alt .input-container input:focus ~ .bar:before, .card.alt .input-container input:focus ~ .bar:after {
background: #ffffff;
}
.card.alt .input-container input:valid ~ label {
color: #ffffff;
}
.card.alt .input-container label {
color: rgba(255, 255, 255, 0.8);
}
.card.alt .input-container .bar {
background: rgba(255, 255, 255, 0.8);
}
这在它是纯 HTML 时有效,但我不确定如何让 CSS 应用于 <@Spring..> 标签
CSS 不能应用于 FreeMarker 标签,因为它们由 FreeMarker 引擎处理并在输出(主要是 HTML)中删除。
<@spring.formInput "customer.email" />
将呈现如下内容:
<input type="text" name="customer.email" />
所以你应该为结果标签准备你的样式。
我是一名优秀的程序员,十分优秀!