No padding when using overflow: auto

Philip picture Philip · Nov 20, 2012 · Viewed 57.5k times · Source

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;
}

Fiddle.

EDIT: I use Firefox

Answer

isHristov picture isHristov · Feb 26, 2014

One more solution without extra DIVs.

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

Working in FF, Chrome, IE8-10.