【问题标题】:Ruby on Rails: How to add "aria-hidden='true'" with link_toRuby on Rails:如何使用 link_to 添加“aria-hidden='true'”
【发布时间】:2015-11-02 16:10:48
【问题描述】:

如何用 Rails 语法写这个?

<a href="/" class="glyphicon glyphicon-fire logo" aria-hidden="true" ></a>

大概是这样的:

<%= link_to '', root_path, class: 'glyphicon glyphicon-fire logo', **???** %>

【问题讨论】:

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


    【解决方案1】:
    <%= link_to '', root_path, ...., 'aria-hidden' => true %>
    

    <%= link_to '', root_path, ...., aria: {hidden: true} %>
    

    【讨论】:

    • 谢谢你,这个有效!很遗憾,我还不能给你点赞。
    • 我没有测试它.. +1
    【解决方案2】:

    试试这个解决方案:

    <%= link_to "", root_path, class: 'glyphicon glyphicon-fire logo', "aria-hidden" => true %>
    

    【讨论】:

      猜你喜欢
      • 1970-01-01
      • 1970-01-01
      • 2018-10-18
      • 1970-01-01
      • 2015-08-17
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      相关资源
      最近更新 更多