更轻松的方式来样式错误消息部分的所有vaadin组件的一部分
我想更改所有具有错误部分部分的vaadin组件的默认样式。我知道的唯一方法是使用@cssimport(value =“ ...”,themefor =“ ...”)我想要样式的每个vaadin组件的注释。还有其他更轻松,更好的方法吗?
我要这样做的原因: 我想将 max-height css属性从 5REM增加到10REM (我希望我可以用一个全局CSS变量编辑任何值),然后添加 Word - break:break-word 属性,因为某些错误消息会溢出水平和垂直。
I want to change the default style for all vaadin components which has errorMessage part. The only way i know is to use @CssImport(value="...", themeFor="...") annotation for each vaadin component I want to style. Is there any other easier, nicer ways to do it?
The reason why i want to do this:
I want to increase the max-height css property from 5rem to 10rem (I wish i could edit this with a global css variable to any value) and add word-break: break-word property too, because some error message overflows both horizontaly and verticaly.
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(2)
一种类似的方法是使用主题创建vaadin-text-field.css,vaadin-combo-box.css等主题/主题/your-theme-name/components/folder的主题。这些文件会自动添加到组件中,从而使其更容易维护(主观)。请查看有关创建自定义主题的更多详细信息。
A similar approach would be to use the theming where you create a vaadin-text-field.css, vaadin-combo-box.css and so on inside your theme/your-theme-name/components/ folder. Those files are automatically added to the components making it s little bit easier to maintain (subjective). See more details in Vaadin documentation about Creating Custom Theme.
如果您不需要支持IE11和Pre-Cromium Edge等较旧的浏览器,则可以轻松地使用
:: part()
selector中的所有vaadin组件在全球stylesheet中的选择器:If you don't need to support older browsers like IE11 and pre-Chromium Edge, you can do that easily for all Vaadin components with the
::part()
selector in a global stylesheet: