html - 为什么 Internet Explorer 8 中没有底部填充?

标签 html css internet-explorer internet-explorer-8 padding

为什么下面的代码在 Internet Explorer 8 中没有底部填充?

HTML:

<div id="wrapper">
    <div class="a">Hello</div>
    <div class="a">Stack</div>
    <div class="a">Overflow</div>
</div>

CSS:

#wrapper {
    border: 1px solid red;
    padding: 10px;
    height: 30px;
    overflow: auto;
}
.a {
    border: 1px solid black;
}

有浏览器兼容性的解决方法吗?

最佳答案

浏览器对规范的解释?

A value of 'scroll' would tell UAs that support a visible scrolling mechanism to display one so that users could access the clipped content.

从字面上看,这意味着浏览器可以取悦自己,并且只需提供对内容的访问,而不是填充或边框;)

兼容的解决方法:

#scroller {
    border: 1px solid red;
    height: 50px;
    overflow: auto;
}

.wrap {padding: 10px;}

.a {
    border: 1px solid black;
}

HTML:

<div id="scroller">
  <div class="wrap">
    <div class="a">Hello</div>
    <div class="a">Stack</div>
    <div class="a">Overflow</div>
  </div>
</div>

关于html - 为什么 Internet Explorer 8 中没有底部填充?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/5804601/

相关文章:

javascript - 使用 Internet Explorer 查看页面时删除元素

html - 添加页面背景颜色,标题颜色消失

css - IE中的任意自动换行

javascript - 获取链接的 ID 并打开警报 javascript

windows-phone-7 - Windows Phone 7 IE 的 CSS3 支持

html - 如何在 HTML 中将一张图片放在另一张图片之上?

javascript - ie 的下拉修复

javascript - 如何在 IE 中散焦下拉菜单? ( Angular )

javascript - 如何暂停滑动图像并在一定时间后再次滑动

javascript - 悬停个人资料图片后带箭头的工具提示框