我的小提琴:
为什么在橙色画布下面有一个小空间的垂直滚动条?
<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;
}
答案 0 :(得分:2)
Canvas有显示:默认为内联..当你将其更改为显示时:阻止它应该显示正常..(所有图像都是相同的情况..)
答案 1 :(得分:0)
正如@Mag所说,你可以添加display:block或设置float属性。您还可以将overflow:hidden添加到包含canvas标记的div中。
答案 2 :(得分:0)
css更改为:
canvas {
background-color: orange;
width:100%;
height:100%;
display:block;}