The problem of space spacing caused by line breaks in HTML

Source: Internet
Author: User

Resolving the problem of space spacing caused by line wrapping of code in HTML

Workaround:

One, simple rough explosion does not change the line

Do not change the line when writing code, input and so on a line to write, then the problem will be resolved. But the code becomes less easy to look at.

Second, set the parent block font size to 0

This also solves the problem, the code is also good-looking, but when you set the parent's font size to 0 o'clock, and you have other fonts to display, you may have to add a span and other tags to wrap it, and reset the font size.
Three: Set Margin-left to-3 pixels

So that the element is shifted from the original position to the left by three pixels, there is no space to see.


For HTML built-in inline-level labels and form element labels, line breaks in the source code in several consecutive inline-level labels are interpreted as a space in the browser.

Includes IE and ff. This space is treated as a blank node (NodeType equals 3 nodes, which is the text node).

Display:inline is used for block-level tags built into HTML;

For line breaks between HTML built-in block-level tags, FF is treated as a blank node (which can be obtained with JS), and IE ignores this line break.

This line break has no effect on the IE and FF pages, and there are no spaces.

The problem of space spacing caused by line breaks in HTML

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.