css - 为什么我的 Canvas 下面有空隙

标签 css html

我的 fiddle :

http://jsfiddle.net/kpdgQ/16/

为什么橙色 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/

相关文章:

html - 使垂直边框呈波浪状

html - CSS 悬停规则只需要应用于父级

javascript - 添加CSS关键帧动画改变图像大小

html - 如何使用 CSS 调整图像大小以适应其容器

html - 填充行内元素的顶部和底部

javascript - 如何将段落位置移动到底部?

javascript - 以编程方式选中所有复选框(使用 CSS3::before 和::after)

html - Bootstrap 3 : Text overlay on image

html - IE7 模式在多行左侧压缩表头内容

css - 流畅的混合电子邮件的不均匀两列布局