开发者

CSS to define different formats for digits/non-digits

开发者 https://www.devze.com 2022-12-20 11:18 出处:网络
How do I use CSS to define a text input area where digits and 开发者_开发百科non-digits are rendered with different formats (bold/italic/color)?

How do I use CSS to define a text input area where digits and 开发者_开发百科non-digits are rendered with different formats (bold/italic/color)?

i.e. 345 dollar -> 345 dollar

Are there anything equivalent to Regular Expression Library fo regex for CSS?

Below are edited


I'm using the Seam framework, any alternatives to achieve this is also welcomed.


As svinto already says, this is definitely not possible. Not even, as far as I can see, using an advanced CSS tool like LESS.

You will have to work around by putting the digit into a tag:

 <span>345</span> dollar

you could of course automate that in a scripting language using Regexes, but I would recommend formatting the output properly instead of relying on such "post-processing", which can break any time when the formatting changes, for example in a different language / locale.


What you want isn't possible.


You can't accomplish this in CSS exclusively. You could use PHP or Javascript to tag content that matches your criteria and style those tags with CSS, however.

0

精彩评论

暂无评论...
验证码 换一张
取 消

关注公众号