How to apply css to only numbers in a text inside/or any

element?

前端 未结 5 965
日久生厌
日久生厌 2020-12-06 02:39

I am Using a Regional language unicode font-face in my site but the numbers are not looking good.

So I want to apply new font-style or css to numbers only..

5条回答
  •  执念已碎
    2020-12-06 03:29

    You can wrap all numbers in p tags with a :

    CSS

    .number {
       font-family: Verdana;
    }
    

    jQuery

    $('p').html(function(i, v){
        return v.replace(/(\d)/g, '$1');
    });
    

    But personally, I would go with James suggestion ;)

    http://jsfiddle.net/ZzBN9/

提交回复
热议问题