【发布时间】:2018-05-04 12:18:55
【问题描述】:
您好,我正在尝试在 vaadin 组件上定义我的自定义样式。我有一个带有styles 的 html 文件,它看起来像这样:
<link rel="import" href="../bower_components/vaadin-lumo-styles/color.html">
<link rel="import" href="../bower_components/vaadin-lumo-styles/typography.html">
<dom-module id="css-style-example" theme-for="vaadin-button">
<template>
<style include="vaadin-button-default-theme">
.card {
box-shadow: 0 4px 8px 0 rgba(0,0,0,0.2);
transition: 0.3s;
width: 40%;
}
.card:hover {
box-shadow: 0 8px 16px 0 rgba(0,0,0,50);
transform: scale(1.05, 1.05)
}
</style>
</template>
</dom-module>
它是gradle 项目,这个file 位于/src/main/resources/frontend/styles。
我正在尝试在我的button 组件上使用这个style,如下所示:
@HtmlImport("frontend://styles/shared-styles.html")
public class BasePageView extends VerticalLayout {
.
.
.
homeButton.setClassName("card");
}
但我不知何故无法让这件事发挥作用。我是css 的新手,请原谅我犯的任何愚蠢错误。
我在 github 上搜索了一些示例,但我有点迷茫,如果有人能向我解释我如何准确地定义 style 为,比如说,vaadin 流,我将不胜感激button ?感谢您的帮助。
【问题讨论】:
标签: java css frontend vaadin vaadin10