PDA

View Full Version : [CLOSED] Undesired top/left margin around viewport with borderlayoutcontainer



joostb
11 Dec 2011, 1:06 AM
I used the following code snippet and I cannot get rid of the unwanted margin on the left and top of the viewport


public class MySampleApplication implements EntryPoint, IsWidget {

public void onModuleLoad() {
Viewport viewport = new Viewport();
viewport.setWidget(this);
RootPanel.get().add(viewport);
}


public Widget asWidget() {


final BorderLayoutContainer con = new BorderLayoutContainer();
con.setBorders(true);
con.setLayoutData(new MarginData(0, 0, 0, 0));


return con;
}
}


it shows up as (tried it in chrome and ie9) :
29917
Am I overlooking something here?

sven
11 Dec 2011, 4:08 AM
This looks like you are not loading the reset.css file.

joostb
11 Dec 2011, 5:55 AM
Thanks Sven for responding (on a sunday ;))
You were right, the path to my 'reset.css' had a typo, all is fine now

kozla13
30 Sep 2013, 7:25 AM
how did you solved this =

Colin Alworth
30 Sep 2013, 8:09 AM
Kolza13, as Sven said (and joosb verified) this is almost always caused by forgetting to add a reference to reset.css. Verify that you've followed all of the steps in the GXT setup instructions, and that there are no errors in the browser's console when loading the app.

kozla13
30 Sep 2013, 11:02 AM
Kolza13, as Sven said (and joosb verified) this is almost always caused by forgetting to add a reference to reset.css. Verify that you've followed all of the steps in the GXT setup instructions, and that there are no errors in the browser's console when loading the app.

the are no errors, the css file is loaded

46074

Colin Alworth
30 Sep 2013, 11:13 AM
Ah, you've turned on the GWT theme 'clean'. This deliberately adds that spacing back in again, even if you have the reset.css working correctly. Since both GXT and GWT are modifying general parts of the page, it can be a toss up to see who will 'win' and actually make changes.

If you do not need or use the clean theme, remove it from your module - note that we are not aware of any other GWT theme causing an issue like this, so you might be good with moving to one of the others.

If you do need the clean theme, you'll need to add more CSS to stop it from adding this padding back in to the page again.

kozla13
30 Sep 2013, 11:15 AM
Found the solution :
the problem was the gwt theme.
<inherits name='com.google.gwt.user.theme.clean.Clean' />
clean.css
was set to:
body {
color: black;
margin: 10px;
border: 0px;
padding: 0px;
background: #fff;
direction: ltr;
}