Get rid of the fill / field around the <canvas> element?

I have a canvas object in a div. It seems that the canvas has a pad around it. I want its edges to touch the edges of the browser screen:

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

but yes, the page still has a ~ 20px mark around the canvas element. There is nothing else on the page other than what was copied above.

I don't think this is a specific GWT problem, maybe html elements have default fill / field?

thank

------ Update ------------

I strangely still see the registration, the Firebug plugin shows me that the body element has a 10px margin somehow:

// 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;
}
+5
source share
2 answers

, HTML- ( , ). , HTML-, :

hml, body, div, canvas {
    margin: 0;
    padding: 0;
}

, , , , , font-size color background-color ( ).

:

+6

: div ( JS, ) , div . , canvas "block" ( , " " ), .

+13

All Articles