Home  >  Article  >  Web Front-end  >  Spaces The display distance is inconsistent in IE, Firefox, and Chrome browsers_HTML/Xhtml_Webpage Production

Spaces The display distance is inconsistent in IE, Firefox, and Chrome browsers_HTML/Xhtml_Webpage Production

WBOY
WBOYOriginal
2016-05-16 16:37:381795browse

  The display effect on IE, Firefox, and Chrome browsers is different, mainly because the width of the preceding space is different.

Online information says
Different browsers will have different default fonts. Generally, the default font of IE is Song Dynasty, while the default font of firefox and chrome is Times New Roman,
Song Dynasty is a font with constant width characters, but Times New Roman is not a font with constant width characters. Because the default fonts of browsers are different, the display width of
space characters  is also different in different browsers.

For example, the following code is tested with IE and chrome respectively

Copy the code
The code is as follows:











I am the first row
nbsp;nbsp;nbsp;nbsp;I am the second row
nbsp;nbsp ;nbsp;nbsp;nbsp;nbsp;I am the third row


The display effect in chrome is as follows:

The display effect under IE9 is as follows:

It can be seen that two  occupy the width of one Chinese character in chrome, while four  only occupy the width of one Chinese character in IE The width of a Chinese character.
Solution:
1. Modify the encoding format of the page
and the compilation method of the page (in myeclipse)

Then right-click IE to modify the encoding display format

2. (Recommended) Set the font in the space line and put Just set the font to any font with equally spaced characters.
For example:

Copy code
The code is as follows:

nbsp;nbsp;nbsp;nbsp;I am the second line


PS: nbsp;Replace with 
Statement:
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