why position absolute is not working properly here with overflow hidden?
Hi Hi,
been watching kevin's video:https://www.youtube.com/watch?v=HbBMp6yUXO0&t=2482s (Responsive navbar tuto)
and I want to ask something, why wen put position:absolute instead of fixed and I add the overflow hidden to the body it still crashes
but with postion:fixed everything working fine
https://stackblitz.com/edit/stackblitz-starters-awbn35hq?file=styles.css

6 Replies
Looking at it quickly now, I don't see the difference between when
fixed
and absolute
in the example
unless you fixed it?if you open the preview in a new tab then inspect it u will get what's in the provided pic
sorry for the noise in the video hhhhhh
Ah, I get it now, sorry.
When something is fixed, it's fixed to the viewport and has no impact on scrolling, so it doesn't add overflow if it's off to the side. If it did, and we scrolled over, we'd never be able to get to it, because it's fixed outside of view.
Absolute, while coming out of the flow of the document, it's still part of the layout, so it will cause overflow.
aah ok so is even overflow hidden won't solve the problem and better use fixed