Html creepy gap

I want to do a plug-in to check whether the html element is fully rendered on the screen, so I create a deemo to write code, but there is a very strange gap, I don"t understand how it came from, so I asked.

clipboard.png
is the white line
html is as follows

<!DOCTYPE html>
<html>
    <head>
        <meta charset="utf8"/>
        <link rel="stylesheet" type="text/css" href="css.css"/>
    </head>
    <body>
        <div class="above"></div>
        <div class="middle">
            <div class="left"></div><div id="item"></div><div class="right"></div>
        </div>
        <div class="below"></div>    
    </body>
    <script src="http://test.yyfai.club/repository/jquery.js"></script>
    <script src="js.js"></script>
</html>

css is as follows

*{
    margin:0;
}
.above{
    background-color:red;
    width:1500px;
    height:600px;
}
.below{
    background-color:blue;
    width:1500px;
    height:600px;
}
.left{
    background-color:-sharp5e5e5e;
    display:inline-block;
    width:600px;
    height:200px;
}
-sharpitem{
    background-color:purple;
    display:inline-block;
    width:300px;
    height:200px;
}
.right{
    background-color:-sharp000;
    display:inline-block;
    width:600px;
    height:200px;
}
.middle{
    white-space:nowrap;
}

the js of that reference is as follows

$(function(){
    //main

});
Jul.07,2022

try

.middle {

font-size: 0;

}


if there is a line break between inline elements in the code, there will be gaps between inline elements on the page.
how to eliminate this uncontrolled gap.

1. Remove the line breaks between inline elements (in the code)
2. First, set the font of the parent tag to 0, and then set the font size of the inline element to cancel

.

change the layout of inline-block to float layout or flex layout


typical inline-block baseline problem, such as giving related elements vertical-align bottom | middle | top


because there is a line break, it is also an element that is empty in html, but it takes up space. The simplest solution is to set the font size to 0

.
Menu