css:
html,body {
margin: 0;
padding: 0;
}
canvas {
margin: 0;
padding: 0;
}
html:
<canvas id="canvas"></canvas>
javascript:
dt = document.getElementById('canvas');
dt.width = window.innerWidth;
dt.height = window.innerHeight;
The result is like this:
Logically shouldn’t canvas be as high as body? Why does body have 4 extra pixels?
Please tell me, thank you!
我想大声告诉你2017-07-05 10:50:24
Add
to bodybody {
font-size: 0
}
Please see: http://www.w3cplus.com/css/fi...