Rails link_to with inline styling

前端 未结 8 1545
傲寒
傲寒 2020-12-15 16:30

I must change a link_to tag color without using a CSS class, how can I do? I\'ve tried something such as

<%= link_to item.description, {}, {:style=>\'c         


        
相关标签:
8条回答
  • 2020-12-15 16:59

    I want to update this topic, because in this time, the syntax is different. In rails 4+, the correct syntax is:

    <%= link_to TEXT, URL, class: 'css_class', style: 'color:#FFFFFF' %>
    
    0 讨论(0)
  • 2020-12-15 17:03

    You can try link_to item.description, {}, {:style => 'color: #FFFFFF'} is ok.

    To color your links you have to set more then color:

    a:link { 
      color: #333333;
    }
    a:visited { 
      color: #FFFFFF;
    }
    a:hover { 
      color: #CCCCCC;
    }
    a:active { 
      color: #333333;
    }
    

    I recommend to use a css class for this.

    0 讨论(0)
提交回复
热议问题