【问题标题】:How to customize color The line-through text decoration on tailwind css如何自定义颜色tailwind css上的直通文本装饰
【发布时间】:2021-07-15 05:20:21
【问题描述】:

我想自定义宽度线“line-through”变得更粗,如 4-6px。我在tailwind.config.js 上自定义了粗线“line-through”,但它不起作用,也许你可以就我的问题给我建议。

//setting tailwind.config.js in plugin:[]    
function ({addUtilities}) {
      const extendLineThrough = {
          '.line-through': {
              'textDecoration': 'line-through',
              'text-decoration-color': 'red',
              'text-decoration-width': '4px'
          },
      }
      addUtilities(extendLineThrough)
 }
<div class="hidden sm:block md:col-span-2 text-rigt">
  <p class="md:pt-1 text-gray-500 line-through">
    Rp. 8000
  </p>
</div>

【问题讨论】:

    标签: javascript html css tailwind-css


    【解决方案1】:

    正确的 css 属性是 text-decoration-thickness 所以你的插件应该是:

    function ({addUtilities}) {
      const extendLineThrough = {
          '.line-through': {
              'textDecoration': 'line-through',
              'text-decoration-color': 'red',
              'text-decoration-thickness': '4px'
          },
      }
      addUtilities(extendLineThrough)
    }
    

    Here 是 Tailwind Play 上的工作版本。

    【讨论】:

    • 感谢 Jheath,它适用于粗细线
    猜你喜欢
    • 2020-06-20
    • 2021-11-23
    • 2020-10-06
    • 2012-09-30
    • 1970-01-01
    • 2021-05-25
    • 2018-06-11
    • 2023-04-01
    • 2021-10-24
    相关资源
    最近更新 更多