在 div 上设置 4px 高度会导致 IE8 中的空间约为 12 像素

发布于 2024-08-04 06:12:55 字数 308 浏览 1 评论 0原文

    <div id="spacer">

    </div>

+

#spacer {
    height: 4px;
}

Firefox 和 Safari 做得很好,屏幕上的空间很小。 IE8 使其大于 4px。 WTF。

如果我将其设置为 200 像素或其他值,空间就很大了。它会减小,直到我达到大约 15 px,此时 IE 继续绘制 15 px 的空间,尽管 css 说是 4 px。

如果你能帮助我,非常感谢。

    <div id="spacer">

    </div>

+

#spacer {
    height: 4px;
}

Firefox and Safari do it right, the space on screen is small. IE8 makes it bigger than 4px. WTF.

If I set it to 200 pixels or whatever, the space is huge. It decreases until I get to around 15 px, at which point IE continues to draw a 15ish px space despite the css saying 4px.

Thanks so much if you can help me.

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(1

入怼 2024-08-11 06:12:55

您几乎肯定会遇到行高和/或字体大小属性。尝试减少这些,空间就会缩小。

#spacer {
    height: 4px;
    line-height:4px;
    font-size:4px
}

You're almost certainly running into the line-height and/or font-size properties. Try decreasing those and the space should shrink.

#spacer {
    height: 4px;
    line-height:4px;
    font-size:4px
}
~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文