更轻松的方式来样式错误消息部分的所有vaadin组件的一部分

发布于 01-22 18:49 字数 500 浏览 5 评论 0原文

我想更改所有具有错误部分部分的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.

image with example of my problem

image with example of my solution

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(2

岁月流歌 2025-01-29 18:49:44

一种类似的方法是使用主题创建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.

北笙凉宸 2025-01-29 18:49:44

如果您不需要支持IE11和Pre-Cromium Edge等较旧的浏览器,则可以轻松地使用:: part() selector中的所有vaadin组件在全球stylesheet中的选择器:

::part(error-message) {
  max-height: 10em;
  word-break: break-word;
}

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:

::part(error-message) {
  max-height: 10em;
  word-break: break-word;
}
~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文