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.

Top Margin in the page

s b
1 decade ago Jul 06, 2012 4:00pm
Jens Jansson
1 decade ago Jul 06, 2012 5:05pm
// Add the label which is the application title
header.addComponent(new Label("<h2>" + applicationTitle + "</h2>", Label.CONTENT_XHTML));

I think that adds a bit of margin, as now you have first a label, and within it <h2>. both probably adds their own margins. Instead do:

Label titleLabel = new Label(applicationTitle);

Now it is the label that has a h2 style, instead of being the a h2 inside the label - so one margin less. Doing titleLabel.addStyleName("h2"); is equivalent, but using references to the themefile is a better practice

Also, the main window has alaways an own layout within it, and that one has margins on by default. You can turn them off with:

Last updated on Jul, 6th 2012
s b
1 decade ago Jul 06, 2012 5:32pm
s b
1 decade ago Jul 06, 2012 5:32pm