没有   的 HTML 中单词之间的多个空格 [英] Multiple Spaces Between Words in HTML without  

查看:36
本文介绍了没有   的 HTML 中单词之间的多个空格的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我使用的是条码字体Free 3 of 9 Extended Regular",在某些情况下,打印输出需要有多个空格,以匹配字段中的字符数.示例:

I'm using a barcode font "Free 3 of 9 Extended Regular" and the print out needs to have multiple spaces in some cases, to match the number of characters in the field. Example:

*AA-XXXX    *"

(商品编号后面有四个空格组成12个字符.如果字符少,条码阅读器会报错.

(four spaces follow the item number to make the 12 characters. The barcode reader will give me an error if there are less characters.

nbsp; 将强制使用多个空格,但是,IE 和 Firefox 都将这些显示为标准字体空间并且不使用条码字体.条形码显示为在非空格字符之间断开.(顺便说一句,只有 IE 6 确实以正确的字体显示 nbsp;.)如果我使用常规空格,它会减少空格数并只显示一个.

nbsp; will force multiple spaces, however, IE and Firefox both display those as standard font spaces and do not use the barcode font. The barcode displays as broken up between the non-space characters. (Incidentally, only IE 6 does display nbsp; in the proper font.) If I use a regular space, it trims the number of spaces down and displays only one.

提前致谢.

推荐答案

查看 white-space css 属性

Look at the white-space css property

使用

.barcode{
    white-space:pre; /* or pre-wrap if you want wrapping to still work. */
}

<span class="barcode">*AA-XXXX    *"</span>

会解决问题.

.barcode{
    font-family:Courier;
    white-space:pre; /* or pre-wrap if you want wrapping to still work.*/
}

<span class="barcode">*AA-XXXX    *"</span>

外部演示:http://www.jsfiddle.net/gaby/Z3gkq/

这篇关于没有 &amp;nbsp; 的 HTML 中单词之间的多个空格的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆