JsFiddle
CSS
body, html {
background: violet
}
* {
margin: 0;
padding: 0
}
.fixed {
height: 100%;
width: 300px;
background: #fff;
right: 0;
position: absolute;
top: 0;
display: -webkit-box;
display: -moz-box;
display: -ms-flexbox;
display: -webkit-flex;
display: flex;
-webkit-flex-direction: column;
-ms-flex-direction: column;
flex-direction: column;
border-left: 1px solid red;
}
.container {
-ms-flex: 1 1 auto;
-webkit-flex: 1 1 auto;
flex: 1 1 auto;
overflow-y: auto;
box-sizing: border-box;
padding: 30px 60px;
}
.footer {
border-top: 1px solid #f0f0f0;
box-sizing: border-box;
padding-left: 35px;
background: red
}
I have tried this above code in both Chrome & Firefox browser. I have attached two screenshots also. I want to know why padding-bottom:60px is not working in Firefox. But, its working fine in Chrome browser. Also not working in IE11
In Chrome Browser (Working Fine) :
In Firefox Browser (Padding Bottom not working. WHY?) :
Really I don't understand this..
An element's padding is the space between its content and its border. The padding-bottom property sets the bottom padding (space) of an element. Note: Negative values are not allowed.
In CSS, a margin is the space around an element's border, while padding is the space between an element's border and the element's content. Put another way, the margin property controls the space outside an element, and the padding property controls the space inside an element.
Adjusting the Margin Size of an HTML Element With CSS You can remove this margin by setting the top and left margin to zero. Like the padding and border, the sizes of specific sides of the margin can be set using margin-left , margin-right , margin-top , and margin-bottom .
There are alot of reasons told by alot of experts like overflow property causes this or display:flex handles padding a bit differently if you search for a reason. @Temani Afif is correct and corrected me as well and here is a recent bug noted with the overflow-y:scroll
or overflow-y:auto
not taking padding-bottom into account.
https://bugzilla.mozilla.org/show_bug.cgi?id=1417667
For a quick solution what you can do is instead of applying the bottom padding on the flex item which has the overflow-y property set, apply it on the item's pseudo element of after e.g.
.container {
-ms-flex: 1 1 auto;
-webkit-flex: 1 1 auto;
flex: 1 1 auto;
overflow-y: auto;
box-sizing: border-box;
padding: 30px 60px 0 60px;
}
.container:after {
content:'';
display:block;
padding-bottom:30px;
}
Hope this helps you and all others out.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With