I noticed some strange spacing between the div borders and elements when I wrapped a few divs inside a container. This issue is only happening on Chrome and Edge, while Mozilla seems to display it correctly.
My code includes the usage of Bootstrap along with some custom CSS:
.fullScreen {
height: 100vh;
width: 100vw;
}
.mainContainer {
align-items: center;
justify-content: flex-start;
}
.row {
margin: 0!important;
}
#box {
margin: 0 0 0 5vh;
height: 90vh;
width: 90vh;
}
.rowEndings {
height: 36vh;
}
.rowMid {
height: 18vh;
}
@media (orientation: portrait) {
.mainContainer {
align-items: flex-start;
justify-content: center;
}
}
<!-- adding bootstrap css -->
<link rel="stylesheet" href="https://stackpath.bootstrapcdn.com/bootstrap/4.5.0/css/bootstrap.min.css" integrity="sha384-9aIt2nRpC12Uk9gS9baDl411NQApFmC26EwAOH8WgZl5MYYxFfc+NcPb1dKGj7Sk" crossorigin="anonymous">
<html lang="en" class="fullScreen">
<body class="fullScreen">
<div class="mainContainer row fullScreen">
<div id="box" class="border border-dark">
<div class="row rowEndings border border-dark"></div>
<div class="row rowMid border border-dark"></div>
<div class="row rowEndings border border-dark"></div>
</div>
</div>
</body>
</html>
Although the alignment appears perfect in the snippet, there seems to be unwanted space for me. Here are some screenshots showcasing the issue:
https://i.sstatic.net/M3BG2.png
https://i.sstatic.net/mAgYl.png
After ruling out padding and margin as the cause, any guidance would be greatly appreciated :)
UPDATE : The problem persists in Edge as well, but removing the 5vh margin from the #box
element resolves the issue.