使用溢出时不填充:自动 [英] No padding when using overflow: auto

查看:83
本文介绍了使用溢出时不填充:自动的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

在盒子上使用overflow-y: auto时,我无法获得padding-bottom的工作.

I can't get padding-bottom to work when I use overflow-y: auto on a box.

HTML:

<div id="container">
    <div id="some_info"></div>
</div>

CSS:

#container {
    padding: 3em;
    overflow-x: hidden;
    overflow-y: auto;
    width: 300px;
    height: 300px;
    background: red;
}

#some_info {
    height: 900px;
    background: #000;
}

小提琴.

编辑:我使用的是Firefox

I use Firefox

推荐答案

另一种无需额外DIV的解决方案.

One more solution without extra DIVs.

#container:after {
  content: "";
  display: block;
  height: 50px;
  width: 100%;
}

在FF,Chrome,IE8-10中工作.

Working in FF, Chrome, IE8-10.

这篇关于使用溢出时不填充:自动的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆