Is such solution fine?

I am doing product landing page right now and struggling with navbar.
I am able do it with flexbox (link) but can’t without. Searching for solution I came across this project (link).
In summary: all navbar elements are absolutely positioned.
Is it a good solution or should be avoided?

Avoid. Absolutely positioning everything means treating the webpage as if it’s a piece of paper, as if it doesn’t change size and things can be drawn at a specific size in specific places. Web pages don’t really work like that: as a simple example, I can change the size of the screen or the size of the fonts whenever I want, on any web page.

Absolute positioning makes things extremely brittle. If you change one element’s size/position in the CSS it generally means you then have to go and change every other element’s size and position in the CSS, and responsive design becomes almost impossible.

Flexbox (and grid!) are generally always the best and easiest way to do layout stuff. CSS layout before flex and grid was frankly awful: they’re good things, use them

2 Likes

yes, flex and grid are the way to go. but, as a side project, i would suggest building a nav bar using floats and the clearfix. its worth doing once so you understand it.

1 Like

Thank You for your answers :slight_smile: