When Should You Use Absolute or Relative Positioning in HTML/CSS?

0
1
Asked By CodingExplorer99 On

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

Answered By WebDevDude34 On

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!

Answered By CreativeCoder22 On

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.

HTML_n00b -

Thanks for clarifying that! So should I just experiment with both to see what works best?

Related Questions

LEAVE A REPLY

Please enter your comment!
Please enter your name here

This site uses Akismet to reduce spam. Learn how your comment data is processed.