How to remove spacing between inline-block elements in CSS? (multiple methods)

不言
Release: 2019-04-04 11:56:23
forward
2884 people have browsed it

The content of this article is about how to remove the spacing between inline-block elements in CSS? (Multiple methods), it has certain reference value. Friends in need can refer to it. I hope it will be helpful to you.

1. Phenomenon description

In the true sense, there will be a gap between the elements presented horizontally inline-block when displayed in newlines or separated by spaces. This is because the browser parses , which will cause line breaks and so on to be read as a space.

2. How to remove spaces

We can remove line breaks and spaces between elements, so that the spacing will naturally disappear, but this will reduce the readability of the code and is not advisable.

Use negative margin values. However, due to external uncertainties and the problem of the extra negative margin value of the last element, this method is not recommended.

   
Copy after login

③ Set font-size:0 to the parent, and then set our font size in the child element, so that the spacing between elements can also be removed.

 
Copy after login

④ Delete the closing tag.

⑤ Use letter-spacing.

⑥ Use word-spacing.

 
Copy after login

【Related recommendations:CSS video tutorial

The above is the detailed content of How to remove spacing between inline-block elements in CSS? (multiple methods). For more information, please follow other related articles on the PHP Chinese website!

Related labels:
css
source:cnblogs.com
Statement of this Website
The content of this article is voluntarily contributed by netizens, and the copyright belongs to the original author. This site does not assume corresponding legal responsibility. If you find any content suspected of plagiarism or infringement, please contact admin@php.cn
Latest Downloads
More>
Web Effects
Website Source Code
Website Materials
Front End Template
About us Disclaimer Sitemap
php.cn:Public welfare online PHP training,Help PHP learners grow quickly!