Space & nbsp display distance inconsistency in ie, firefox, and chrome browsers _ HTML/Xhtml _ webpage Creation

Source: Internet
Author: User
Spaces are displayed differently in ie, firefox, and chrome browsers, mainly because the width of the leading space is different. This may be because different browsers have different default fonts, generally, the default fonts of IE are all. Below we will introduce several good solutions. The display effects on ie, firefox, and chrome are not the same, mainly because the front space width is different.

Online Information
Different browsers have different default fonts. Generally, the default fonts of IE are, while those of firefox and chrome are Times New Roman,
Is an equal-width font, but Times New Roman is not an equal-width font, because the default font of the browser is different,
The display width of the space character varies with the browser.

For example, the following code uses IE and chrome to test

The Code is as follows:












I am the first line
Nbsp; I am the second line
Nbsp; I am the third line


The effect on chrome is as follows:

In IE9, the following results are displayed:

We can see that two characters occupy the width of one Chinese Character in chrome, and four characters occupy the width of one Chinese Character in IE.
Solution:
1. Modify the page encoding format
And page compilation method (in myeclipse)

Right-click IE and modify the encoding display format.

2. (recommended) set the font on the line of space and set the font to any Character spacing.
For example:

The Code is as follows:


Nbsp; I am the second line



PS: nbsp; Replace

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.