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:
我使用的是条码字体“免费3 / 9的扩展规则”,打印输出需要在某些情况下有多个空格,以匹配字段中的字符数。例子:
*AA-XXXX *"
(four spaces follow the item number to make the 12 characters. The barcode reader will give me an error if there are less characters.
(在项目号后面加4个空格,构成12个字符。如果字符比较少,条形码阅读器会给我一个错误。
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.
,不过,IE和Firefox将强制使用多个空格作为标准字体空间,并且不使用条码字体。条码显示在非空格字符之间。(顺便说一句,只有IE 6显示了;在适当的字体。)如果我使用一个常规的空格,它会减少空格的数量,只显示一个空格。
Thanks in advance.
提前谢谢。
4 个解决方案
#1
64
Look at the white-space
css property
看看空白css属性
Using
使用
.barcode{
white-space:pre; /* or pre-wrap if you want wrapping to still work. */
}
and
和
<span class="barcode">*AA-XXXX *"</span>
will do the trick.
上大做文章。
.barcode{
font-family:Courier;
white-space:pre; /* or pre-wrap if you want wrapping to still work.*/
}
<span class="barcode">*AA-XXXX *"</span>
external demo: http://www.jsfiddle.net/gaby/Z3gkq/
外部演示:http://www.jsfiddle.net/gaby/Z3gkq/
#2
16
Use <pre>
when whitespace is significant.
当空格重要时使用
。
#3
7
you can replace all spaces with  
您可以用 替换所有空格
#4
-1
I like to use this special white-space that HTML and JavaScript does not detect as white-space. ->" "
我喜欢使用HTML和JavaScript不能检测到的特殊空白。”- >“
It looks better on the code end too.
它在代码端看起来也更好。
UPDATE
更新
Looks like stack over flow replaces it with a regular space so here is the ASCII code for it
看起来堆栈/流将它替换为一个常规空间,这是它的ASCII代码
Dec 160 Hex A0 Oct 240
12月16日
#1
64
Look at the white-space
css property
看看空白css属性
Using
使用
.barcode{
white-space:pre; /* or pre-wrap if you want wrapping to still work. */
}
and
和
<span class="barcode">*AA-XXXX *"</span>
will do the trick.
上大做文章。
.barcode{
font-family:Courier;
white-space:pre; /* or pre-wrap if you want wrapping to still work.*/
}
<span class="barcode">*AA-XXXX *"</span>
external demo: http://www.jsfiddle.net/gaby/Z3gkq/
外部演示:http://www.jsfiddle.net/gaby/Z3gkq/
#2
16
Use <pre>
when whitespace is significant.
当空格重要时使用
。
#3
7
you can replace all spaces with  
您可以用 替换所有空格
#4
-1
I like to use this special white-space that HTML and JavaScript does not detect as white-space. ->" "
我喜欢使用HTML和JavaScript不能检测到的特殊空白。”- >“
It looks better on the code end too.
它在代码端看起来也更好。
UPDATE
更新
Looks like stack over flow replaces it with a regular space so here is the ASCII code for it
看起来堆栈/流将它替换为一个常规空间,这是它的ASCII代码
Dec 160 Hex A0 Oct 240
12月16日