CSS relative + absolute positioning
In my work I use a lot of CSS and one of the things I always hate about CSS is trying to get things positioned exactly where you want them. Yesterday I came across this website that clearly explains the differences between a couple of layout properties. It’s nice to have a clear overview like that and it even had something that was new for me. In the 4th example on that page it shows that you can “nest” position:absolute inside position:relative. It’s a very useful feature of CSS but in my opinion it’s just one of those stupid things. Why didn’t they just make a position:absolutefromparent property or something like that? In that case it would be a lot easier to find that this functionality even exists just by looking at a list of position properties for example.
Because you don’t always want the direct parent to be the relative one. It could also be the grandparent, or grandgrandparent, etc.
CSS does have some obscure things, but I think this specific piece of functionality is so important that any good tutorial mentions it.
Good point, I hadn’t thought about the grandparent stuff. But… I still don’t understand why they sort of overloaded the position:relative to also mean that the absolute coordinate system of the children will be reset. Perhaps a resetabsolute property for the parent or grandparent, etc. would be better.