更改小数点后的字体大小 [英] change font size after decimal point

查看:1008
本文介绍了更改小数点后的字体大小的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我正在使用Opencart电子商务网站,我需要自定义产品价格字体大小,
例如:
产品价格:$ 250.50 我需要设置字体大小 $ = 16px; 250 = 22px; .50 = 14px;
如何为单个数字设置不同的字体大小..

i am working with a Opencart eCommerce website, i need to customize product price font size, for example: product price: $ 250.50 i need to set font size for $ = 16px; 250 = 22px; .50 = 14px; how can i set different font size for a single amount..???

这是我的动态PHP代码在我的产品页面上显示价格文字:

this s my dynamic php code that display price text to my product page:

<span class="price"><?php echo $product['price']; ?></span>

我的产品列表页面不是单个产品的价格,有很多产品的价格表。

my product list page not a single product with price, there is a lots of product with price list.

感谢任何帮助,如果任何人在这之前提出了同样的问题,请与我分享链接...

thanks for any help, if anybody asked same question before here, please share with me that links...

推荐答案

$.each($('.price'), function(){
var price = $(this).html();
$(this).html(price.replace(/(\D*)(\d*\.)(\d*)/,'<span style="font-size:16px;">$1</span><span style="font-size:22px;">$2</span><span style="font-size:14px;">$3</span>'));
});

http://jsfiddle.net/gr8x5/10/

这篇关于更改小数点后的字体大小的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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