Using 100dvh and 100dvw makes the body scrollable

I want the body to take all the available space on the screen. But I don't why it becomes scrollable instead of just stopping the edges. I'm I doing something wrong ?
No description
No description
19 Replies
Tok124 (CSS Nerd)
You do not need to set a width on body, it already takes full width by default, same as any other block level element And you should probably also add in margin:0; on the body since it comes with an 8px default margin
FA_TAAA
FA_TAAAOP2mo ago
So I removed the width But it's still scrollable up and down I use normalize.css, it already has that
Tok124 (CSS Nerd)
Aah i see, well, try add
*,*::before,*::after {
box-sizing:border-box;
}
*,*::before,*::after {
box-sizing:border-box;
}
If that does not solve the problem, it must be something overflowing
Tok124 (CSS Nerd)
If this does not solve problem, share code on https://codepen.io
CodePen
An online code editor, learning environment, and community for front-end web development using HTML, CSS and JavaScript code snippets, projects, and web applications.
FA_TAAA
FA_TAAAOP2mo ago
that solved the issue maybe normalize.css is not good maybe I should use reset.css instead ?
Tok124 (CSS Nerd)
What i usually do is to take reset.css from meyerweb, then i customize it to my own preference
13eck
13eck2mo ago
You shouldn't be useing any CSS resetin 2025. They're from a bygone era when browsers didn't even look remotely alike. Resets were used not only to have a consistent look across browsers but to also give the dev a consistent dev experience across browsers. Since they were started being used, browsers have come together to bring a consistent experience to all. It's like how you don't use jQuery in 2025—almost everything it did is now part of the JS spec so you're loading extra code for literally no benefit.
ἔρως
ἔρως2mo ago
the body had an 8px margin by default, by the way
13eck
13eck2mo ago
@ἔρως ☝️
ἔρως
ἔρως2mo ago
No description
ἔρως
ἔρως2mo ago
oh im late and dummy then
13eck
13eck2mo ago
You're late and not reading lol
ἔρως
ἔρως2mo ago
i read, i didn't pay attention :/
FA_TAAA
FA_TAAAOP2mo ago
Thanks for clarifiying @13eck Question : What's a good practice to start your css file ?
FA_TAAA
FA_TAAAOP2mo ago
Kevin Powell
YouTube
Simplest CSS reset to prevent headaches
Get the code here: https://codepen.io/kevinpowell/pen/QWxBgZX #css -- Come hang out with other dev's in my Discord Community 💬 https://discord.gg/nTYCvrK Keep up to date with everything I'm up to ✉ https://www.kevinpowell.co/newsletter Come hang out with me live every Monday on Twitch! 📺 https://www.twitch.tv/kevinpowellcss --- He...
ἔρως
ἔρως2mo ago
@charset "UTF-8"; if you need compatibility with old browsers which you may need you usually don't see this, because usually isn't needed and most browsers assume utf-8 i would just go with the base reset the other reset has several issues that kevin didn't talk about in the video for example, kevin nukes the styles for <pre> and <code>, and ruins all <ul> and <ol> elements also, there's a better image reset that he made a video about too
13eck
13eck2mo ago
I’m on mobile but search for “Jen Simmon CSS Remedy”. It’s old but she explains everything and why you might want to include it in your CSS
Martin Bavio
Martin Bavio2mo ago
in 2025 it seems like starters are the new resets. (I learnt a thing or two by reading Chris's starter description)
Martin Bavio
Martin Bavio2mo ago
GitHub
GitHub - jensimmons/cssremedy: Start your project with a remedy for...
Start your project with a remedy for the technical debt of CSS. - GitHub - jensimmons/cssremedy: Start your project with a remedy for the technical debt of CSS.

Did you find this page helpful?