簡體   English   中英

如何更改 php 中的字體大小?

[英]How to change the font size in php?

我正在嘗試更改含稅價格的字體大小,而不僅僅是后綴“含稅”。 順便提一句'。 有可能這樣做嗎?

add_filter( 'woocommerce_get_price_suffix', 'bbloomer_add_price_suffix_price_inc_tax', 99, 4 );
       
function bbloomer_add_price_suffix_price_inc_tax( $suffix, $product, $price, $qty ){
    $suffix = ' excl. btw <br> ' . wc_price( wc_get_price_including_tax( $product ) ) . ' incl.btw';
    return $suffix;
}

如上所述,您可以使用 span 來控制字體屬性。 像這樣

function bbloomer_add_price_suffix_price_inc_tax( $suffix, $product, $price, $qty ){
    $suffix = ' excl. btw <br> ' . 
              '<span style="font-size: large">'.
              wc_price( wc_get_price_including_tax( $product ) ) . ' incl.btw'.
              '</span>';
    return $suffix;
}

為清楚起見,上面的代碼已格式化。 它將字體顯示為large ,但您可以使用像素或其他單位。 該字體大小(或其他屬性僅在跨度內有效。

暫無
暫無

聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.

 
粵ICP備18138465號  © 2020-2024 STACKOOM.COM