【问题标题】:Applying CSS for some words in a link_to link对 link_to 链接中的某些单词应用 CSS
【发布时间】:2014-02-13 04:04:39
【问题描述】:

我的链接是

= link_to '+++ Sync categories', "cats/sync", :remote=>true

我需要为'+++'部分应用一些 CSS

当我这样做时它可以工作,但我在“+++”部分和其余部分之间有一个空格,它不会重定向到链接。

%span#create_cat_arrow.arrow +++
= link_to 'Sync categories', "cats/sync", :remote=>true

如何仅将 CSS 应用于“+++”部分?

提前致谢。

【问题讨论】:

    标签: css ruby-on-rails haml link-to


    【解决方案1】:
    = link_to "cats/sync", :remote=>true do
      %span.myclass '+++ '
      Sync categories
    

    或者如果你想要线条样式

    = link_to "cats/sync", :remote=>true do
      %span{style: "color: #c0c0c0"} '+++ '
      Sync categories
    

    【讨论】:

    • 感谢您的回复。但我不知道如何使用这种样式将参数传递给 sycn。你能帮我解决这个问题吗?提前致谢
    • link_to("cats/sync?key=value", :remote => true) 做...,或者如果您按照路线指示使用路径助手,您应该能够使用 link_to(cats_sync_path(:my => parameter), :remote => true) 做...
    猜你喜欢
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 2018-08-29
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    相关资源
    最近更新 更多