Time for action – creating a new Vaadin theme
Follow these steps to change the way labels look:
Open the themes example application on your IDE.
Edit the
cool
mixin (incool.scss
) to include one rule for labels:@mixin cool { @include chameleon; .v-label { color: #fff; background-color: #4455aa; font: 16px Verdana, Arial; padding: 5px; margin-bottom: 10px; } }
Run the application.
What just happened?
Well, this happened:
We defined a rule to be applied to labels. The CSS class v-label
is automatically added to every label element.
Tip
How to know which CSS classes are added by Vaadin? The fastest way to get this information is by inspecting the HTML in your browser. You can also find this information in the Book of Vaadin, the official Vaadin reference. For example, if you are interested in the CSS classes used for Label, you can take a look at (https://vaadin.com/book/vaadin7/-/page/components.label.html).