【发布时间】:2016-06-28 13:57:40
【问题描述】:
在我的 Vaadin 应用程序中,我想更改焦点文本字段的颜色,这没问题。另外,我想更改属于 TextField 的标题的颜色。如何使用 css 实现这一点?
.v-textfield.textfield-default {
border: none;
border-bottom: 1px solid $non-active-field;
outline: none;
height: 3rem;
font-size: 1rem;
margin: 0 0 15px 0;
padding: 0;
box-shadow: none;
box-sizing: content-box;
transition: all 0.3s;
}
.v-textfield.textfield-default:focus {
border-bottom: 1px solid $default;
}
.v-caption-default-caption {
color: purple; //changes the text to purple
top: 0.8rem;
left: 0.75rem;
font-size: 1rem;
cursor: text;
transition: .2s ease-out;
}
.v-caption-default-caption:focus {
color: red; //is never called
}
.v-caption-default-caption:active {
color: blue; //is never called either
}
【问题讨论】:
-
你能发布你的 HTML 吗?
-
我的 HTML 是什么意思?这是一个 Java Vaadin 应用程序
-
如果我是正确的,你不能在 CSS3 中拥有父选择器,但它们将在 CSS4 中可用。你应该在聚焦时触发一些事件,这会将一个类添加到标题中,并删除该类如果您模糊文本字段,则来自标题