使用样式表编辑图像大小

时间:2018-12-03 17:15:24

标签: bootstrap-4 ruby-on-rails-5.2

我不知道如何创建一个类,以便可以操纵样式表中的图像大小,并将其作为徽标插入此处:

<%= link_to image_tag("royal_lancers_badge.png"), root_path, class: "navbar-brand" %>

我正在使用bootstrap gem-导航栏的完整代码为:

<nav class="navbar navbar-expand-md navbar-dark bg-dark">
  <div class="container">
    <%= link_to image_tag("royal_lancers_badge.png"), root_path, class: "navbar-brand" %>
    <ul class="nav navbar-nav">
      <li class="nav-item"><%= link_to "Home", root_path, class: "nav-link" %></li>
      <li class="nav-item"><%= link_to "About", about_path, class: "nav-link" %></li>
      <li class="nav-item"><%= link_to "Contact", contact_path, class: "nav-link" %></li>
      <% if user_signed_in? %>
      <li class="nav-item pull-md-right"><%= link_to "Log out", signout_path, method: :delete, class: "nav-link" %></li>
      <% else %>
       <li class="nav-item pull-md-right"><%= link_to "Sign up", signup_path, class: "nav-link btn btn-primary" %></li>
       <li class="nav-item pull-md-right"><%= link_to "Sign in", signin_path, class: "nav-link" %></li>
      <% end %>
    </ul>
  </div>
</nav>

1 个答案:

答案 0 :(得分:0)

这是有效的关键更改:

 <%= link_to image_tag("royal_lancers_badge.png", class: "logo"), root_path, class: "navbar-brand" %>