你如何<paper-input>
在 Polymer 1.0 中设置标签的样式
您能否展示如何专门自定义标签文本颜色、下划线颜色、输入文本颜色的样式,以及如何使用它们来访问它们custom-style
?
你如何<paper-input>
在 Polymer 1.0 中设置标签的样式
您能否展示如何专门自定义标签文本颜色、下划线颜色、输入文本颜色的样式,以及如何使用它们来访问它们custom-style
?
您可以通过更改此处<paper-input>
列出的自定义属性来更改 的外观(最新版本的信息已移动 - 它适用于 v1.1.21 之前的版本)。
这是一个例子:
<style is="custom-style">
:root {
/* Label and underline color when the input is not focused */
--paper-input-container-color: red;
/* Label and underline color when the input is focused */
--paper-input-container-focus-color: blue;
/* Label and underline color when the input is invalid */
--paper-input-container-invalid-color: green;
/* Input foreground color */
--paper-input-container-input-color: black;
}
</style>
编辑:
选择:root
器用于定义适用于所有自定义元素的自定义属性。您还可以针对特定元素而不是:root
:
<style is="custom-style">
paper-input-container.my-class {
--paper-input-container-color: red;
--paper-input-container-focus-color: blue;
--paper-input-container-invalid-color: green;
--paper-input-container-input-color: black;
}
</style>