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

React sample code to implement login form

As a Vue user, it's time to expand React. Fro...

Interpretation of the module for load balancing using nginx

Table of contents Two modules for using nginx for...

Things to note when migrating MySQL to 8.0 (summary)

Password Mode PDO::__construct(): The server requ...

A simple way to achieve scrolling effect with HTML tag marquee (must read)

The automatic scrolling effect of the page can be...

Summary of uncommon js operation operators

Table of contents 2. Comma operator 3. JavaScript...

How to wrap HTML title attribute

When I was writing a program a few days ago, I wan...

Tutorial on installing and using virtualenv in Deepin

virtualenv is a tool for creating isolated Python...

How to represent various MOUSE shapes

<a href="http://" style="cursor...

The difference and usage between div and span

Table of contents 1. Differences and characterist...

Play mp3 or flash player code on the web page

Copy code The code is as follows: <object id=&...

Solution to the problem that mysql local login cannot use port number to log in

Recently, when I was using Linux to log in locall...

Detailed steps for installing and configuring MySQL 5.7

1. Download MySQL 1. Log in to the official websi...