man*_*ans 4 html javascript css jquery opencart
我正在使用Opencart电子商务网站,我需要自定义产品价格字体大小,例如:
product price: $ 250.50我需要设置字体大小,$ = 16px; 250 = 22px; .50 = 14px;
如何为单个数量设置不同的字体大小.. ???
这是我的动态PHP代码,显示价格文本到我的产品页面:
<span class="price"><?php echo $product['price']; ?></span>
Run Code Online (Sandbox Code Playgroud)
我的产品列表页面不是单个产品的价格,有很多产品的价目表.
感谢您的帮助,如果有人在此之前提出同样的问题,请与我分享链接...
$.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>'));
});
Run Code Online (Sandbox Code Playgroud)