How to remove the spacing between inline-block elements

Source: Internet
Author: User

I wrote a topic page a few days ago.

Div {width: 900px ;}
Div A {display: inline-block; width: 300px ;}
<Div>
<A href = ""> </a>
<A href = ""> </a>
<A href = ""> </a>
</Div>

It was found that the 900 container could not accommodate 3 million a containers, so I had to worry about it and secretly reduced A Little Bit Of A in it. But I was later discovered by my colleagues, saying that this is because the inline element and inline-block both have spacing by default. You can float it and the spacing will disappear. Float: Left; then the spacing disappears.

The following describes how to remove the inline and inline-block elements:

1. You can directly write the elements on one line in HTML or write the closed tag and the second start tag on one line or between lines to add comments or directly remove the closed tag, but the last one cannot be removed.

2. Set margin-Right to a negative value, but consider the font and text size of the context.

3. Set the font of the child element first, and then set the font-size: 0px of the parent element; // chrome:-WebKit-text-size-adjust: none;

4. Set the parent element "letter-spacing" or "word-spacing" to a negative value. Consider the font. also set the value of "letter-spacing" or "word-spacing" when the sub-element is long as the text.

5. Float: left;

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.