[英]How to center GWT html page?
我尝试使用以下CSS将GWT html页面居中
body {
color:#000000;
font:1px Impact;
text-align:center;
width:1000px;
margin:auto;
}
我也尝试了几种不同的保证金
margin: 1px auto;
要么
margin: 1% auto;
该页面会在中间显示一小段时间,然后切换到左侧。 我让代码在GWT之外工作。
问题是什么?
在HTML / JSP文件中添加一个
center
设置的新div
,然后在该div
添加根组件。
入口点类别:
public class GWTProject implements EntryPoint {
public void onModuleLoad() {
RootPanel.get("container").add(initComponent);
}
}
HTML / JSP:
...
<body>
<div id="container" align="center"></div>
</body>
...
它是如此简单。
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.