-7

我有一个带有以下行的 PHP 函数:

print ' <span class="highlight">SALE!: </span><span>£</span>'.$sxml[sales_price_inc];

我需要应用这种 CSS 样式:

style="text-decoration:line-through;

.$sxml[sales_price_inc] 

它打印的可变文本

4

2 回答 2

4

您可以使用跨度包装您的文本,并且只需使用样式变量:

$style = "text-decoration:line-through;";
print ' <span class="highlight">SALE!: </span><span>£</span><span style="' . $style . '">' . $sxml['sales_price_inc'] . '</span>';
于 2012-11-30T21:59:11.573 回答
3
print ' <span class="highlight">SALE!: </span><span>£</span><span style="text-decoration:line-through;">'.$sxml[sales_price_inc].'</span>';
于 2012-11-30T21:58:46.497 回答