Use font-size:0 to remove gaps between inline-block elements

Source: Internet
Author: User

The latest version of modern browser support Inline-block, only the damned IE6, 7 does not support Inline-block, but IE6, 7 can be

Display:inline;
Zoom:1;

To simulate


The following are the Inline-block compatible codes:

View Sourceprint?display:inline-block;*display:inline;*zoom:1;width:100px;vertical-align:top;


But we have found that in the firefox,safari,opera,ie8+ in the Inline-block element will be inexplicably more than 3px spacing, in fact, this is a newline character, if the inline-block element between the line break removed, The distance between the 3px will disappear.


There is no difference in the appearance of the code to remove the gap, the answer is yes.

You can add to the parent element of the Inline-block:

font-size:0;

Then set the font back in Inline-block.

Use font-size:0 to remove gaps between inline-block elements

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.