How to make the position of DIV1 in the middle of DIV2

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
12084.png

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)
12087.png

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);