【问题标题】:How to fade text in asp.NET/css如何在 asp.NET/css 中淡化文本
【发布时间】:2017-10-18 21:15:00
【问题描述】:

我正在制作折扣商品,并尝试同时显示原始价格和新价格。我希望原始价格被划掉和褪色。我已经有了line-through,但我无法弄清楚文本淡入淡出的风格。 CSS有这样的东西吗?

谢谢!

这是我的 ASP 代码:

<div ID="OriginalPrice" class="pricing-price">
    <span class="price-unit">$</span><asp:Label style="text-decoration: line-through"   ID="lblOrigPrice" runat="server">This is a test</asp:Label><span class="price-tenure">/mo</span>
</div>

【问题讨论】:

  • 带淡入淡出,你的意思是:(1)浅色或灰色; (2) 颜色变化的渐变,例如从左到右或从上到下;或者(3)一种动态的视觉效果,随着时间的推移颜色变得更淡或更透明?请澄清!
  • 对不起!嗯,应该是浅灰色。就像想象你有一个折扣码,在你输入它后,原来的价格被划掉并褪色(不像新价格那样明显)
  • 我应该补充一下,我是前端的新手,所以如果这是一个愚蠢的问题,我深表歉意。

标签: css asp.net


【解决方案1】:

您可以为此使用opacity。它的值可能介于 0 和 1 之间,例如 opacity: 0.5

<div ID="OriginalPrice" class="pricing-price">
    <span class="price-unit">$</span><asp:Label style="text-decoration: line-through;opacity: 0.5;"   ID="lblOrigPrice" runat="server">This is a test</asp:Label><span class="price-tenure">/mo</span>
</div>

为了得到你想要的,你可能想要稍微提高价值。

【讨论】:

    猜你喜欢
    • 1970-01-01
    • 1970-01-01
    • 2023-03-05
    • 1970-01-01
    • 2023-03-22
    • 1970-01-01
    • 2017-04-04
    • 2013-06-19
    相关资源
    最近更新 更多