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 occupy the width of one Chinese character in Chrome, while four 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 |
<<: Based on JavaScript ES new features let and const keywords
>>: Implementing custom radio and check box functions with pure CSS
1. Trash or Classic? Web technology updates very ...
Introduction MySQL should be a very common databa...
Table of contents Function call optimization Func...
WIN10 64-bit install the latest MySQL8.0.18 downl...
This article shares the specific code of jQuery t...
1. CSS Box Model The box includes: margin, border...
Virtual machines are very convenient testing soft...
This article example shares the specific code of ...
1. Test environment name Version centos 7.6 docke...
Recently, I encountered a problem in the process ...
1. Introduction to Nginx Nginx is a web server th...
The full name of Blog should be Web log, which mea...
When we add an svg image to display, react prompt...
The smallest scheduling unit in k8s --- pod In th...
Copy code The code is as follows: <!DOCTYPE ht...