Question

GWT tutorial - StockWatcher.

I am overriding StockWatcher.css:

body {
    padding: 10px;
}

But no padding is applied, at least on the left, and the whole frame is flush to the left side.

Was it helpful?

Solution

Some panels in GWT use absolute positioning. Applying padding to widgets that are direct children of these panels won't work. In such situations you use, for example,

myLayoutPanel.setWidgetLeftRight(myWidget, 10, Unit.PX, 10, Unit.PX);

You can apply padding and margins to any widget whose parent does not use absolute positioning for its children (e.g. widgets inside FlowPanel or HTMLPanel).

Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top