【问题标题】:TailwindCC: no-underline class does not work for my <a> tag?Tailwind:无下划线类不适用于我的 <a> 标签?
【发布时间】:2021-08-05 13:44:50
【问题描述】:

我试图避免在我的&lt;a&gt; 标签下出现下划线。我已经根据文档添加了 "no-underline" 类,但我的链接下仍然有下划线?我在下面添加了代码:

<div
  class="
    my-3
    flex flex-wrap
    -m-1
    text-center
    justify-center
    items-center
    no-underline
  "
>
  <div class="m-auto">
    {% for tag in tags %}
    <a
      href="{% routablepageurl blog_page 'post_by_tag' tag.slug %}"
      class="no-underline"
    >
      <span
        class="
          font-mono
          m-1
          bg-gray-200
          hover:bg-gray-300
          rounded-full
          px-2
          py-1
          font-bold
          text-sm
          leading-loose
          cursor-pointer
          shadow-lg
          no-underline
        "
        >{{ tag }}</span
      >
    </a>
    {% empty %} No tags yet {% endfor %}
  </div>
</div>

Thanks for the help!

【问题讨论】:

  • 该类的样式表是什么?通常是text-decoration: none;
  • 另一个观察是你的班级有这么多班级,hover:bg-gray-300 这不是班级
  • @Bharat,我使用的是tailwindCSS,你提到的类是内置的,我使用的是命名约定。
  • 啊,我明白了。谢谢

标签: html css tailwind-css


【解决方案1】:

no-underline 添加到

<div class="m-auto">

并确保父 div 中没有 underline 类。

你也可以尝试添加

style="text-decoration: none !important;"

如果这些不起作用,则进入 divs 标签。

【讨论】:

  • 我将style="text-decoration: none !important;" 添加到我的标签中,感谢您在这里帮助我。
猜你喜欢
  • 2022-09-30
  • 2022-11-24
  • 2013-05-26
  • 1970-01-01
  • 2021-01-06
  • 2017-07-09
  • 1970-01-01
  • 2018-03-17
  • 1970-01-01
相关资源
最近更新 更多