大型数字的CSS字符间距 [英] CSS Kerning for Large Numbers
问题描述
我意识到,在状态大数字格式化与,
千之间,所以你会写 $ 1,000,000.00
。在南非,,
是非标准的,可以用作小数点,而不是。
p>
我们会写 $ 1000000.00
这是可怕的。典型的解决方案是使用一些空格: $ 1 000 000.00
。
它仍然看起来很可怕。
如果我假设值是一个特定的DOM元素的货币格式(即数字后缀有 .00
即使它是双零),理想的解决方案是使用CSS以某种方式操纵每个nth-last-letter的字距。我有一个强烈的偏好不使用javascript,但也许不可能...
这样的东西可能吗?最好的解决方案是什么?
我认为使用普通的空格,然后用CSS减小它们的宽度会做的伎俩。 / p>
例如
.currency {
word-spacing:-2px
}
请参阅 https:// jsfiddle。 net / 5f9c4cdu /
I realise that in the states large numbers are formatted with a ,
between thousands so you would write $1,000,000.00
. In South Africa a ,
is non-standard and could be used as a decimal point instead of the .
.
We would write $1000000.00
which is horrible to read. The typical solution is to use a bit of whitespace: $1 000 000.00
.
The problem with that solution is that it still looks terrible.
If I assume values are currency formatted in a particular DOM element (i.e. the numbers are suffixed with .00
even if it's double zero), the ideal solution would be to use CSS to somehow manipulate the kerning of every nth-last-letter. I have a strong preference not to use javascript but maybe that's not possible...
Is something like this possible? What's the best solution?
I would think that using ordinary spaces and then reducing their width with CSS would do the trick.
e.g.
.currency {
word-spacing: -2px
}
See https://jsfiddle.net/5f9c4cdu/
这篇关于大型数字的CSS字符间距的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!