Important Notice - Forums is archived

To simplify things and help our users to be more productive, we have archived the current forum and focus our efforts on helping developers on Stack Overflow. You can post new questions on Stack Overflow or join our Discord channel.

Product icon

Vaadin lets you build secure, UX-first PWAs entirely in Java.
Free ebook & tutorial.

How to apply css margins on a label

Amira Mannaii
7 years ago Apr 14, 2016 5:24pm
Olli Tietäväinen
7 years ago Apr 15, 2016 7:41am


I know it's not exactly a response to your stated problem, but generally you'd want to use the Label's value property (which you can set as the Label's constructor parameter or with productSettingsLabel.setValue()). The caption is a property is inherited from AbstractComponent and it's more like an additional textual description you can add to any Component, like a TextField or an Image.

If you do want to use both the caption and the value of the Label, take a look at the Book of Vaadin section about common component features, where you'll find the CSS selectors you can use for the caption.

Hope this helps,
Olli Tietäväinen
Vaadin Developer