Day 48: inset 0
It’s time to get me up to speed with modern CSS. There’s so much new in CSS that I know too little about. To change that I’ve started #100DaysOfMoreOrLessModernCSS. Why more or less modern CSS? Because some topics will be about cutting-edge features, while other stuff has been around for quite a while already, but I just have little to no experience with it.
On day 9 I’ve talked about the inset shorthand properties inset, inset-inline, and inset-block. I don’t believe that I will need those often, but
inset can come in handy when you want one element to fill another element entirely.
If you have an outer element and an inner element and you want the inner element to fill its parent, you can use absolute positioning and set
border: 10px solid hotpink;
Instead, you could also just set
Of course, this also applies to a fixed positioned element that you want to fill the viewport with.
See on CodePen.