volking
(volking volking)
December 2, 2011, 9:56am
1
there is some code.
java:
private Component getDashboard() {
CssLayout dashboard = new CssLayout();[b]
//DIV1
[/b]
dashboard.setWidth("100%");
dashboard.setDebugId("dashboard");
dashboard.addStyleName("dashboard");
CssLayout dashboardContent = new CssLayout();[b]
//DIV2
[/b]
dashboardContent.setDebugId("dashboard-content");
dashboardContent.addComponent(new Label("xxxsfasfd"));
dashboard.addComponent(dashboardContent);
return dashboard;
}
css:
.dashboard {
padding: 1em;
font-size: 13px;
}
#dashboard-content {
width: 100%;
background-color: #FFFFFF;
border: 1px solid #BBBBBB;
border-radius: 0.4em 0.4em 0.4em 0.4em;
min-height: 600px;
}
the actual display as shown in pic1
but I want to get as pic2 shows
Is there any way to to achieve this feature
Fredrik
(Fredrik Rönnlund)
December 2, 2011, 8:39pm
2
Are you sure you’re trying with only this application and this css? I tried your example and the div2 (dashboard-content) is centered nicely inside div1. (see screenshot)
volking
(volking volking)
December 3, 2011, 2:52am
3
issue is resolved
just comment statement: dashboard.setWidth(“100%”);
java:
private Component getDashboard() {
CssLayout dashboard = new CssLayout();//DIV1
[b]
// dashboard.setWidth("100%");
[/b]
dashboard.setDebugId("dashboard");
dashboard.addStyleName("dashboard");
CssLayout dashboardContent = new CssLayout();//DIV2
dashboardContent.setDebugId("dashboard-content");
dashboardContent.addComponent(new Label("xxxsfasfd"));
dashboard.addComponent(dashboardContent);
return dashboard;
}
i use vaadin 6.7.1
volking
(volking volking)
December 4, 2011, 1:14am
4
issue is resolved
just comment statement: dashboard.setWidth(“100%”);
java:
private Component getDashboard() {
CssLayout dashboard = new CssLayout();//DIV1
[b]
// dashboard.setWidth("100%");
[/b]
dashboard.setDebugId("dashboard");
dashboard.addStyleName("dashboard");
CssLayout dashboardContent = new CssLayout();//DIV2
dashboardContent.setDebugId("dashboard-content");
dashboardContent.addComponent(new Label("xxxsfasfd"));
dashboard.addComponent(dashboardContent);
return dashboard;
}
i use vaadin 6.7.1
I forgot something,Must use csslayout
CssLayout mainExpand = new CssLayout();
setContent(mainExpand);
Component dashboard = getDashboard();
mainExpand.addComponent(dashboard);