The space is displayed differently in IE, Firefox, and Chrome browsers

The space is displayed differently in IE, Firefox, and Chrome browsers
  The display effects on IE, Firefox, and Chrome browsers are slightly different, mainly because the width of the preceding space is different.

Online information says that different browsers have different default fonts. Generally, the default font of IE is Songti, while the default font of Firefox and Chrome is Times New Roman.
Songti is a font with monospaced characters, but Times New Roman is not a font with monospaced characters, because the default fonts of browsers are different.
The display width of the space character   varies in different browsers.

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

Copy code
The code is as follows:

<table>
<tr>
<td>I am the first row</td>
</tr>
<tr>
<td>nbsp;nbsp;nbsp;nbsp;I am the second row</td>
</tr>
<tr>
<td>nbsp;nbsp;nbsp;nbsp;nbsp;nbsp;I am the third row</td>
</tr>
</table>

The display effect in Chrome is as follows:

The display effect under IE9 is as follows:

It can be seen that two &nbsp; occupy the width of one Chinese character in Chrome, while four &nbsp; occupy the width of one Chinese character in IE.
Solution:
1. Modify the encoding format of the page <meta http-equiv="content-type" content="text/html; charset=gbk">
And how to compile the page (in myeclipse)

Then right-click IE to modify the encoding display format

2. (Recommended) Set the font on the line with spaces. Just set the font to any font with equal spacing between characters.
like:

Copy code
The code is as follows:

<div style="font-family: '宋体'">nbsp;nbsp;nbsp;nbsp;I am the second row</div>

PS:nbsp;Replace with&nbsp;

<<:  Based on JavaScript ES new features let and const keywords

>>:  Implementing custom radio and check box functions with pure CSS

Recommend

Web Design Experience: Self-righteous Web Designers

1. Trash or Classic? Web technology updates very ...

In-depth understanding of the use of r2dbc in MySQL

Introduction MySQL should be a very common databa...

Detailed explanation of Mysql function call optimization

Table of contents Function call optimization Func...

jQuery achieves the shutter effect (using li positioning)

This article shares the specific code of jQuery t...

Example code for implementing triangles and arrows through CSS borders

1. CSS Box Model The box includes: margin, border...

VMware Workstation download and installation detailed tutorial

Virtual machines are very convenient testing soft...

JS realizes the case of eliminating stars

This article example shares the specific code of ...

Docker online and offline installation and common command operations

1. Test environment name Version centos 7.6 docke...

Detailed explanation of important cascading concepts in CSS

Recently, I encountered a problem in the process ...

Nginx Linux installation and deployment detailed tutorial

1. Introduction to Nginx Nginx is a web server th...

Write a formal blog using XHTML CSS

The full name of Blog should be Web log, which mea...

HTML pop-up div is very useful to realize mobile centering

Copy code The code is as follows: <!DOCTYPE ht...