【问题标题】:Rails: display tooltip with red color for link_toRails:为 link_to 显示红色的工具提示
【发布时间】:2021-01-17 20:08:29
【问题描述】:

我想为 rails 中的 link_to 创建一个带有红色字体的工具提示。 例如:下面的代码我用于link_to

<%= link_to "javascript:void(0)", 'data-toggle': 'tooltip', title:"Click to delete \n <span style='color:red;'>Warning:- You will not be able to use </span>",onclick: "delete",style: "color:blue;",class: "custom_tooltp" %>

问题:我没有收到红色的警告文本。

提前致谢。

【问题讨论】:

标签: javascript css ruby-on-rails bootstrap-4


【解决方案1】:

在 HTML 中创建红色链接:

<a href="https://blog.corsego.com/" style="color:#FF0000;">Red Link</a>

使用红宝石链接到:

= link_to "Blog", "https://blog.corsego.com", target: :_blank, style: "color:#FF0000;"

【讨论】:

  • 感谢您回复@Yshmarov。但我想更改工具提示文本颜色而不是链接颜色。
【解决方案2】:

发布一些我找到解决方案并为我工作的研究。

css: .red-tooltip + .tooltip > .tooltip-inner {背景色:#ffffff;颜色:#000000;} js : $('[data-toggle="tooltip"]').tooltip();

警告:- 您将无法使用 ",onclick: "delete",style: "color:blue;",class: "red-tooltip" %>

【讨论】:

    猜你喜欢
    • 2012-05-24
    • 1970-01-01
    • 1970-01-01
    • 2014-06-08
    • 2011-12-03
    • 2013-05-07
    • 1970-01-01
    • 1970-01-01
    • 2015-06-28
    相关资源
    最近更新 更多