我的 fiddle :
为什么橙色 Canvas 下有一个垂直滚动条,中间有一点空隙?
<div>
<canvas></canvas>
</div>
div {
height:100%;
width:100%;
background:blue;
}
canvas {
background-color: orange;
width:100%;
height:100%;
}
html,body{
height:100%;
width:100%;
}
html, body, div, span, applet, object, iframe,
h1, h2, h3, h4, h5, h6, p, blockquote, pre,
a, abbr, acronym, address, big, cite, code,
del, dfn, em, img, ins, kbd, q, s, samp,
small, strike, strong, sub, sup, tt, var,
b, u, i, center,
dl, dt, dd, ol, ul, li,
fieldset, form, label, legend,
table, caption, tbody, tfoot, thead, tr, th, td,
article, aside, canvas, details, embed,
figure, figcaption, footer, header, hgroup,
menu, nav, output, ruby, section, summary,
time, mark, audio, video {
margin: 0;
padding: 0;
border: 0;
font-size: 100%;
font: inherit;
vertical-align: baseline;
}
body {
line-height: 1;
}
最佳答案
Canvas 默认有 display:inline.. 当你把它改成 display:block 它应该能正常显示..(所有图片都是一样的..)
关于css - 为什么我的 Canvas 下面有空隙,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/18978673/