The issue is if you follow the book, all your child vertical or horizontal layouts inherit these settings. The workaround in the thread works great, but the ticket has a proposed solution that makes a lot more sense.
The new layouts that are currently being finalized in a separate branch
(“layoutgraph”) will fix this issue. I think the current layouts (introduced in alpha2) also fixed this.
So from now on, you can set the margin directly to the actual DOM element using the style name, no need for a separate shadow/measure element. The margins are still applied using CSS padding, but you can use CSS margin as well if you’re not setting the layouts size in percentages.
{{{
// Java
VerticalLayout layout = new VerticalLayout(); layout.addStyleName(“foo”);