When the label uses Display:inline-block, the object is presented as an inline object, but the object's contents are presented as a block object. Adjacent inline objects are presented in the same line, allowing spaces. (To be exact, the element to which this attribute is applied renders as an inline object and the surrounding elements remain on the same line, but you can set the properties of the width and height plot elements)
With inline-block horizontally rendered elements, there will be spacing between line-wrapping or space-separated, a simple example:
<! DOCTYPE html>
<meta charset= "UTF-8" >
<title>Document</title>
<style>
UL Li {
List-style:none;
}
UL Li Span {
Display:inline-block;
width:40px;
height:20px;
Background:pink;
}
</style>
<body>
<ul>
<li>
<span>1</span>
<span>2</span>
</li>
</ul>
</body>
The effect of the page rendering is as shown in the following illustration:
Picture 1
Two elements between the space, and browser, the size of the space resolution is also different, which is to restore the effect of the picture to a certain extent, how to solve it
First, use a folded line annotation, as shown in the following figure
Second, do not fold lines or leave blank (code is not very readable), as shown in the following figure
Three, the previous end tag and the next closing label are placed on one line (no spaces left), as shown in the following figure
Four, the use of margin-right or margin-left negative values, has been achieved to eliminate whitespace, as shown in the following figure
Five, use JS to write HTML + as shown in the following figure
Use font-size:0 using the parent element; As shown in the following figure
Seven, use float float, as shown in the following figure
Viii. use position to position each label individually (too troublesome, not recommended)