Overflowing issues ( Height related )

Hey there! I am having this issue where my content inside the div is overflowing, I am totally unsure and clueless why is this happening. Here this is the screen recording of actual site, and what is happening, I have this div inside of main tag, and dummy text to illustrate whats happening, blue background is to show the real overflowing problem, Thanks
15 Replies
SheldonFromBBT
SheldonFromBBTOP•12mo ago
This is the code, p tag contains the dummy text
No description
Jochem
Jochem•12mo ago
you're setting height to 100%, which will take 100% of the parent, which is 100% of the viewport, so it can't grow to accomodate the content if you set min-height: 100% instead, the div will grow with the content
SheldonFromBBT
SheldonFromBBTOP•12mo ago
In root body tag I have set the background color and h-dvh w-dvw
Jochem
Jochem•12mo ago
share a live example them, codepen or tailwind playground it's probably still the h-full though
SheldonFromBBT
SheldonFromBBTOP•12mo ago
This is the root html
No description
SheldonFromBBT
SheldonFromBBTOP•12mo ago
%sveltekit.body% contains the children layouts which is the above code
Jochem
Jochem•12mo ago
yes, and h-dvh will set the height to the size of the viewport, which the other elements will then follow if you give all the children height: 100% change h-full to min-h-full on the div
SheldonFromBBT
SheldonFromBBTOP•12mo ago
Thanks! but my issue was solved only when I changed the h-full to min-h-full on main tag and not on div tag Why this happened though?
Jochem
Jochem•12mo ago
You told the div to be the size of the viewport, so that's what it did
SheldonFromBBT
SheldonFromBBTOP•12mo ago
Ahh okay! was this whole thing due dynamic vh property only?
Jochem
Jochem•12mo ago
Not necessarily the dynamic part. You set the body to be the size of the viewport and that gets inherited by every child and used as a reference for the 100% heights on those.
SheldonFromBBT
SheldonFromBBTOP•12mo ago
Oh Okay, this helps And last question 😅 Why Am I getting horizontal scrollbar ?
Jochem
Jochem•12mo ago
at a guess, you're setting a lot of widths. the body has a default padding body, main, and div already take up all available space, so you don't need w-full / w-dvw on anything I've seen here
SheldonFromBBT
SheldonFromBBTOP•12mo ago
Okay, thanks! you helped a lot
Jochem
Jochem•12mo ago
glad to help 🙂
Want results from more Discord servers?
Add your server