Search code examples
cssruby-on-railshamllink-to

Applying CSS for some words in a link_to link


My link is

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

And I need to apply some CSS for the part '+++'

It works when I do it like this, but I have a space between the '+++' part and the rest which doesn't redirect to the link.

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

How can I apply the CSS only for the '+++' part?

Thanks in advance.


Solution

  • = link_to "cats/sync", :remote=>true do
      %span.myclass '+++ '
      Sync categories
    

    or if you want in line styles

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