2016-11-29 67 views
-2

我在業餘時間嘗試創建一個啓動。但不熟悉php。在定製代碼時,我遇到了以下問題:一段中有兩種不同的css樣式

我只是想在我的頁面上將產品的價格背後添加回顯「包括運費」。但是,現在「包括運輸」回聲正在從class =「price」中得到css,我希望我的自定義回聲是一個正常的段落,並保持class =「price」的價格。兩人必須互相留下。

代碼如下所示:

<p class="price"><?php echo $product->get_price_html(); ?> <?php $customshippingtext = " Including shipping "; echo $customshippingtext; ?> </p> 

猜測它是非常容易和希望,我不得不潛入PHP的原因,我可能會能夠計算出來的時間。現在只需要一個快速解決方案..

巨大的感謝提前!

親切的問候,

布魯姆

回答

2

p標籤內使用的跨度與另一個類,如下:

<p class="price"><span class="another-class"> </span></p> 
0

回聲跨度爲好,以自定義類,而且比CSS按照你的喜好來設計風格。

<p class="price"><?php echo $product->get_price_html(); ?> <?php $customshippingtext = " Including shipping "; echo '<span class="othertxt">'.$customshippingtext.'</span>'; ?> </p> 

或者你也可以用內聯樣式

<p class="price"><?php echo $product->get_price_html(); ?> <?php $customshippingtext = " Including shipping "; echo '<span class="othertxt" style="color: black;">'.$customshippingtext.'</span>'; ?> </p> 
+0

跨度funtion做的工作,非常感謝您的答案設置樣式正道! – Brum

相關問題