I'm just starting out with HTML and CSS, and I'm trying to wrap my head around how to use positioning. Should I prefer using absolute or relative positioning, or is it better to rely on tools like flexbox for layout? Also, is it common to overlap divs when building a website, or is there a preferred way to handle that?
4 Answers
Absolute positioning has its uses, but it's not always the best choice. Generally, Flexbox and relative positioning are more effective. However, there are specific situations, like tooltips, where absolute positioning makes sense. Just don’t rely on it all the time!
When you’re learning, don’t stress about doing everything perfectly like a pro. Set small goals to create web pages, then try to improve them with different techniques or tools. It’s all about experimentation! For instance, I once tried building a simple app and learned that sometimes you reinvent the wheel—just part of the learning process!
Overlapping is definitely something you might need to do! Just remember that position and display serve different purposes. Display controls how elements are shown, while position dictates where they are placed on the page. Do a quick search for both to get a better understanding! 😉
If you can, go for Flexbox. It's generally easier to work with for layouts. Overlapping divs can be stylish but it's really about the design you want to achieve. Just remember that how you position elements is more about style than any strict programming rule.
Related Questions
Set Wordpress Featured Image Using Javascript
How To Fix PHP Random Being The Same
Why no WebP Support with Wordpress
Replace Wordpress Cron With Linux Cron
Customize Yoast Canonical URL Programmatically
[Centos] Delete All Files And Folders That Contain a String