我正试图在Google的Web Toolkit中找到解决方法。所以我想制作一个100%高度和100%宽度布局的小页面。我不想保证金,没有填充和没有滚动条。GWT布局:我将如何修复此布局(DockPanel)?
我用了一个DockPanel中,并将其加入到这样的页面:
package de.kuntze.client;
import com.google.gwt.core.client.EntryPoint;
import com.google.gwt.user.client.ui.DockPanel;
import com.google.gwt.user.client.ui.HasAlignment;
import com.google.gwt.user.client.ui.Label;
import com.google.gwt.user.client.ui.RootPanel;
import com.google.gwt.user.client.ui.Widget;
public class BeginningGWT_BookExample implements EntryPoint {
public void onModuleLoad() {
DockPanel mainPanel = new DockPanel();
mainPanel.setBorderWidth(5);
mainPanel.setSize("100%", "100%");
mainPanel.setVerticalAlignment(HasAlignment.ALIGN_MIDDLE);
mainPanel.setHorizontalAlignment(HasAlignment.ALIGN_CENTER);
Widget header = new Label("Header");
mainPanel.add(header, DockPanel.NORTH);
mainPanel.setCellHeight(header, "30px");
Widget footer = new Label("Footer");
mainPanel.add(footer, DockPanel.SOUTH);
mainPanel.setCellHeight(footer, "25px");
Widget categories = new Label("Categories");
mainPanel.add(categories, DockPanel.WEST);
mainPanel.setCellWidth(categories, "150px");
mainPanel.setCellHeight(categories, "500px");
Widget tasks = new Label("Tasks");
mainPanel.add(tasks, DockPanel.EAST);
RootPanel.get().add(mainPanel);
}
}
我还添加了一些CSS代码来配置html和body标签:
* {
margin: 0px;
padding: 0px;
border: 1px solid black;
}
html, body{
height: 100%;
width: 100%;
min-height: 100%;
}
我使用HTML页面看起来像这样:
<!doctype html>
<html>
<head>
<meta http-equiv="content-type" content="text/html; charset=UTF-8">
<link type="text/css" rel="stylesheet" href="BeginningGWT_BookExample.css">
<title>Web Application Starter Project</title>
<script type="text/javascript" language="javascript" src="beginninggwt_bookexample/beginninggwt_bookexample.nocache.js"></script>
</head>
<body>
</body>
</html>
所以这里来了我的问题:在编译的网页是一个5-10px(估计)保证金在我无法解释或摆脱的左边。我通过Chrome和Firefox浏览过,结果是一样的。我怎样才能摆脱左边的额外空间?我想有一个100%填充的网站。
预先感谢任何答案
安德烈
P.S:我itentionally,因为我需要学习,没有它去,现在没有使用UI活页夹。所以请不要就此开始讨论。谢谢;-)
Hi和感谢了很多:这解决了我的问题,我认为我必须仔细看看Theming。 – AndreKuntze
谢谢,这也帮助我了,至于为什么这是默认行为,给出clean.css不存在。 –