Padding with position absolute
Trick to set top and left at 0 but still have padding applied from parent element.
by Matthew Day
HTML
<div class="parent">
<div class="child">Hello World!</div>
</div>
CSS
* {
box-sizing: border-box;
}
.parent {
position: relative;
width: 200px;
height: 100px;
padding: 20px;
border: 1px solid blue;
}
.parent .child {
position: absolute;
top: 0;
left: 0;
padding: 20px;
border: 1px solid red;
}