No padding when using overflow: auto

后端 未结 10 2097
天涯浪人
天涯浪人 2020-12-13 23:33

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

HTML:

10条回答
  •  生来不讨喜
    2020-12-13 23:53

    Style the parent div normally and make the inner div do what you want it to do.

    Remove overflow-x and overflow on #container, change height to 100% and add overflow-y:scroll; on #some_info

    #container {
        padding: 3em;
        width: 300px;
        height: 300px;
        background: red;
    }
    
    #some_info {
        height: 100%;
        background: #000;
        overflow-y:scroll;
        width:100%;
    }
    

    Working Demo: http://jsfiddle.net/9yuohxuh/

提交回复
热议问题