I'm just starting out with HTML and CSS and I'm trying to understand the best practices for positioning elements. Should I prefer using absolute positioning or relative positioning, or is it better to use something like display flex? Also, is it common to overlap divs when creating a website, or should that be avoided?
2 Answers
Most of the time, it's better to use Flexbox if you can. Overlapping divs is more about your design choice than it is about right or wrong coding practices. So go for it if that's the look you want!
Overlapping elements can be quite common in web design. Remember that 'display' controls how something shows up, while 'position' deals with where it appears on the page. It's good to have both tools in your toolbox! Just check out both and see what fits your needs.
Thanks for clarifying that! So should I just experiment with both to see what works best?