3 ms·
CSS debugging heuristic #1: 9 times out of 10 it's a `position: relative` or `overflow: hidden` you need.
by nicoburns 6y ago
CSS debugging heuristic #1: 9 times out of 10 it's a `position: relative` or `overflow: hidden` you need.
- runawaybottle 6y agoLow key pro tip.
- ImpressiveWebs 6y agoNot true at all, especially in modern CSS. Position relative is only needed for using absolute positioning. That should be extremely rare. And overflow: hidden is an old workaround for float-based layouts that should never be used in 2020 unless you’re debugging a legacy project. And even in that case, you should be using a proper clearfix instead.
- willio58 6y agoWoah there. Position relative can help with z-index issues. Also, I’ve never dealt with float based layouts but I can tell you overflow hidden is useful outside of that context.
- ImpressiveWebs 6y agoAgain, z-index is so rarely used and if you needed overflow hidden for something other than floats, then you were doing your CSS wrong. I’m not saying that to be arrogant, I’ve written books on CSS and written articles for some of the biggest web dev sites online. It’s just true that many developers don’t understand CSS and often use the wrong tool for the right job, so to speak.
- commandlinefan 6y ago*: border 1px red
- Kagerjay 6y ago`position: relative`, and `position: absolute` imo is the source of so many responsive web design CSS bugs always use flexbox first before position relative