Gap between divs...

I made a div container with border in that div I made another div with background color. Between those 2 divs there is a tiny tiny gap. Margin: -2px; fixes it. Can anyone explain me why is this happening ? I even removed all my css that affects layout like margins or paddings, tried to set them to 0 and it didn't work. :/
34 Replies
Psyzen
Psyzenā€¢3y ago
How can there be a gap between parent div and child div without margin and padding LOL
MarkBoots
MarkBootsā€¢3y ago
Do you have other content inside that inner div? please share some more code html/css. preferably in a codepen (https://pen.new)
CodePen
...
Psyzen
Psyzenā€¢3y ago
https://codepen.io/LCSNeo/pen/xxjpKME I also have the reset.css but it shouldn't affect it.
MarkBoots
MarkBootsā€¢3y ago
can not see a gap
Psyzen
Psyzenā€¢3y ago
Really ? I can clearly see it on chrome
Psyzen
Psyzenā€¢3y ago
MarkBoots
MarkBootsā€¢3y ago
not in firefox or chrome
Psyzen
Psyzenā€¢3y ago
the Fudge šŸ˜„ what is going on with my chrome
MarkBoots
MarkBootsā€¢3y ago
are you zoomed?
Psyzen
Psyzenā€¢3y ago
No
MarkBoots
MarkBootsā€¢3y ago
so not zoomed in or out? (try ctrl+0)
Psyzen
Psyzenā€¢3y ago
If I zoom in to 125% the gap disappears but at 100% still exists and yes I did use ctrl+0
MarkBoots
MarkBootsā€¢3y ago
the code is correct, so no worry about that. but what is happening with your browser ? I don't know
Psyzen
Psyzenā€¢3y ago
Good question I would that the localhost apache server messing up but its not just in localhost
MarkBoots
MarkBootsā€¢3y ago
hm, maybe someone else has an idea
Psyzen
Psyzenā€¢3y ago
Hopefully
CodeNascher
CodeNascherā€¢3y ago
whats your monitor's resolution? (both of you) i own a UHD display and i sometimes have very thin lines flashing similar to that, if i overlay some divs with the same dimensions but different colors. or if i build a 3d cube with skew and rotate. it's almost like half a pixel or less seemingly not lining up. disappears when zooming
MarkBoots
MarkBootsā€¢3y ago
yea, pixel density could be an issue. but on 100% it are whole pixels (all the values are px or em). So default should be okay
Psyzen
Psyzenā€¢3y ago
CodeNascher
CodeNascherā€¢3y ago
hmm, is it getting better if you turn off windows' scaling?
Psyzen
Psyzenā€¢3y ago
sadly it does LOL but then everything on my screen is just for ants to read šŸ˜„
CodeNascher
CodeNascherā€¢3y ago
lol, i run my uhd at 100% so it definitely seems like a scaling/pixel density problem
Psyzen
Psyzenā€¢3y ago
I can barely read it anything 100%
Psyzen
Psyzenā€¢3y ago
vs
Psyzen
Psyzenā€¢3y ago
125%
CodeNascher
CodeNascherā€¢3y ago
hehe, but yeah, it's just a display error. nothing wrong with your code
Psyzen
Psyzenā€¢3y ago
But.. it irritates me šŸ˜‚
CodeNascher
CodeNascherā€¢3y ago
nothing i can do lol
MarkBoots
MarkBootsā€¢3y ago
i think you can scale only text in "advanced scaling settings" (im on windows 11 so i can not check)
CodeNascher
CodeNascherā€¢3y ago
yep, discord has text scaling oh, misinterpreted that you mean in windows can confirm for 10
Psyzen
Psyzenā€¢3y ago
There is only custom scaling I will try that
MarkBoots
MarkBootsā€¢3y ago
do you have Accessibility > text size?
Psyzen
Psyzenā€¢3y ago
Found it. Thank you. Now to adjust it. No wonder I was going crazy multiple times thinking my code is bad.
Want results from more Discord servers?
Add your server