Roll20 uses cookies to improve your experience on our site. Cookies enable you to enjoy certain features, social sharing functionality, and tailor message and display ads to your interests on our site and others. They also help us understand how our site is being used. By continuing to use our site, you consent to our use of cookies. Update your cookie preferences .
×
Create a free account

[HELP] Weird Space Between DIVs

1544784918
Finderski
Pro
Sheet Author
Compendium Curator
Hoping someone can help me understand where this space is coming from: The two boxes with dice rolls are set to inline-block with a width of 50% using box-sizing: border-box.  There's 0 margin and 0 padding.  I had to turn on white-space: nowrap to figure out why the second box kept going under the first.  I can get rid of the space by setting a negative left margin, but would rather not do that if I don't have to. Any help would be greatly appreciated.
1544792276
Kirsty
Pro
Sheet Author
I'm not proficient enough to be able to tell what the problem is without seeing your code. When I run into a problem like this, I'll often set the background colours to something weird so that I can see exactly where the boundaries are between divs - sometimes that helps.
1544796959
Scott C.
Forum Champion
Sheet Author
API Scripter
Compendium Curator
It's probably because of the whitespace setting, which I'm assuming is on the overall container that both are in. This would cause the whitespace from your formatted code (aka indenting your nested lines) to display as well.
1544807384
Jakob
Sheet Author
API Scripter
It's definitely whitespace. Use CSS grid or flexbox and never worry about whitespace again 🙂.
1544812969
Scott C.
Forum Champion
Sheet Author
API Scripter
Compendium Curator
Jakob said: It's definitely whitespace. Use CSS grid or flexbox and never worry about whitespace again . This! CSS Grid is a miracle worker for 2-dimensional layouts. Flexbox is awesome as well, and actually better than grid when you only care about alignment along one axis.
1544816209
Finderski
Pro
Sheet Author
Compendium Curator
Flexbox did the trick.  I'll just need to start making all my DIVs that. :-/ Thanks. :)
1544957795
Jakob
Sheet Author
API Scripter
Nice! Yes you should. Inline-blocks are really a thing of the past, sadly Roll20's built-in classes use them (and probably will continue to do so for legacy compatibility).