To remove the space between inline-block elements, you can try one of the following methods:
- Use the
font-size
trick:
Copy code.parent {
font-size: 0;
}
.child {
display: inline-block;
font-size: 16px;
}
This works because inline-block elements respect the font-size of their parent element. By setting the font-size of the parent element to 0, the space between the inline-block elements will be removed.
- Use negative margins:
Copy code.child {
display: inline-block;
margin-right: -4px;
}
This works because the negative margin will overlap the space between the inline-block elements and remove it. You may need to adjust the value of the margin to match the size of the space you want to remove.
- Use the
letter-spacing
trick:
Copy code.parent {
letter-spacing: -4px;
}
.child {
display: inline-block;
}
This works because the letter-spacing property controls the space between characters in a text. By setting a negative value for letter-spacing on the parent element, the space between the inline-block elements will be reduced.
if you need any help in wordpress development click here
Pingback: What is a clearfix? - WpTip