How can I use CSS for Vaadin components?(如何将 CSS 用于 Vaadin 组件?)
问题描述
我似乎看到了一些例子,人们回答了如何通过添加 CSS 代码从组件中获取某些特定行为的问题,但似乎没有人解释如何使用该 CSS 代码将其连接到 Java 组件...
I seem to be seeing examples, where people answer to questions how to get some specific behavior from components by adding CSS code, however nobody seems to explain how to use that CSS code to connect it to Java components...
.v-table-body{
overflow: hidden !important;
}
例如,我如何在我创建的表上使用此代码?
How do I use for instance this code on my table that I create?
Table table = new Table(caption);
table.addContainerProperty("Visit ID", Long.class, null);
推荐答案
您可以创建自己的自定义主题.请参阅 https://vaadin.com/book/-/page/themes.creating.html 如何做到这一点.
在这个主题中,您有一个 css 样式表,您可以在其中放置您的规则.
You can create you own custom theme. See https://vaadin.com/book/-/page/themes.creating.html how to do that.
In this theme you have a css style sheet where you can put your rules.
在每个组件上,您都可以使用 addStyleName 函数添加额外的类名:
On every Component you can use the addStyleName function to add an additional class name:
Table table = new Table("MyCaption");
table.addStyleName("mystyle");
现在您可以在样式表中使用它:
Now you can use this in your style sheet:
@import "../reindeer/styles.css";
.mystyle{
overflow: hidden !important;
}
这篇关于如何将 CSS 用于 Vaadin 组件?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持编程学习网!
本文标题为:如何将 CSS 用于 Vaadin 组件?


- Safepoint+stats 日志,输出 JDK12 中没有 vmop 操作 2022-01-01
- Eclipse 插件更新错误日志在哪里? 2022-01-01
- value & 是什么意思?0xff 在 Java 中做什么? 2022-01-01
- 从 finally 块返回时 Java 的奇怪行为 2022-01-01
- C++ 和 Java 进程之间的共享内存 2022-01-01
- Jersey REST 客户端:发布多部分数据 2022-01-01
- 如何使用WebFilter实现授权头检查 2022-01-01
- Java包名称中单词分隔符的约定是什么? 2022-01-01
- Spring Boot连接到使用仲裁器运行的MongoDB副本集 2022-01-01
- 将log4j 1.2配置转换为log4j 2配置 2022-01-01