【网页优化】中英文间自动添加空格

@> 有研究显示,打字的时候不喜欢在中文和英文之间加空格的人,感情路都走得很辛苦,有七成的比例会在 34 岁的时候跟自己不爱的人结婚,而其余三成的人最后只能把遗产留给自己的猫。毕竟爱情跟书写都需要适时地留白。
——vinta

Demo

这是一段中文与English混排的文字,我在编辑时并没有手动Pangu。

使用

text-autospace.js上传到你的服务器,并在body尾部引入。

1
<script type="text/javascript" src="text-autospace.min.js"></script>

在head中插入以下css

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
html hanla:after {
content: " ";
display: inline;
font-family: Arial;
font-size: 0.89em;
}

html code hanla,
html pre hanla,
html kbd hanla,
html samp hanla {
display: none;
}

html ol > hanla,
html ul > hanla {
display: none;
}
Your browser is out-of-date!

Update your browser to view this website correctly.&npsb;Update my browser now

×