我在 div 中有一个画布对象。画布周围似乎有一个填充物。我希望它的边缘接触浏览器屏幕的边缘:
// my html file:
<body>
<div id="canvasholder"></div>
</body>
// my java gwt code
Canvas canvas = Canvas.createIfSupported();
canvas.setWidth("100%");
canvas.setHeight("100%");
RootPanel.get("canvasholder").add(canvas);
但是是的,页面仍然在画布元素周围有约 20 像素的边距。除了上面复制的内容之外,页面上没有其他内容。
我不认为这是特定于 GWT 的问题,可能是 html 元素具有默认的填充/边距?
谢谢
- - - 更新 - - - - - -
奇怪的是,我仍然看到填充,萤火虫插件向我展示了 body 元素以某种方式有 10px 的边距:
// firebug inspection of the body element:
body {
background: none repeat scroll 0 0 #FFFFFF;
border: 0 none;
color: black;
direction: ltr;
margin: 10px; // huh?
padding: 0;
}
// my css file:
hml, body, div, canvas {
margin: 0px;
padding: 0px;
}
div.logParent {
position: absolute;
top: 20px; left: 20px;
color: black;
z-index: 2;
}