Last Updated: February 25, 2016
·
672
· basiclines

Something you didn't know about CSS padding

Using %units in CSS padding matches the width of the container, even if you use padding-top/padding-bottom:

.container { width: 320px; }
.child { padding-bottom: 50%; } /* 160px */

MDN Source