Search code examples
htmlgoogle-chromeinternet-explorerfirefoxnon-breaking-characters

How to unify the space width in different browsers


The space   shows different width in Chrome and IE, how to unify them?

In IE it is shorter than in Chrome and Firefox.

I've tried use the font but nothing seems to have happened.

<span style="font-family: 宋体, SimSun; font-size: 20px;">&nbsp;&nbsp;</span>

Solution

  • You can try to add padding in css to add a similar amount of space in span across various browsers.

    Try to refer example below.

    <!doctype html>
    <head>
    	 <title>demo</title>
    <style>
    	span.padd{padding-left:60px;}
    </style>
    </head>
    <body>
    
    <span class="padd">Demo Text</span>
    
    </body>
    </html>