-1

为什么 ul class="nav pull-right" 行不起作用?我认为这取决于 if 和 else 但我不知道......有人可以帮助我吗?

<div class="navbar navbar-fluid-top">
  <div class="navbar-inner">
    <div class="container-fluid">
      <a class="btn btn-navbar" data-target=".nav-collapse" data-toggle="collapse">
        <span class="icon-bar"></span>
        <span class="icon-bar"></span>
        <span class="icon-bar"></span>
      </a>
      <a class="brand" href="/">Test1</a>
      <div class="container-fluid nav-collapse">
        <ul class="nav">
          <% if user_signed_in? %>
          <li><%= link_to "Link1", "/path1"  %></li>
          <li><%= link_to "Link2", "/path2"  %></li>
          <li><%= link_to "Link3", "/path3"  %></li>
          <li>Welcome, <%= current_user.email %>!</li>
          </ul>
          <ul class="nav pull-right">
          <li><%= link_to "Log out", destroy_user_session_path, method: :delete %></li>
        <% else %>
          <li><%= link_to "Sign in", new_user_session_path %></li>
          <li><%= link_to "Sign up", new_user_registration_path %></li>
        </ul>
          <% end %>
      </div><!--/.nav-collapse -->
    </div>
  </div>
</div>
4

2 回答 2

0

试试这个:

<div class="container-fluid nav-collapse">
        <% if user_signed_in? %>
        <ul class="nav">
          <li><%= link_to "Link1", "/path1"  %></li>
          <li><%= link_to "Link2", "/path2"  %></li>
          <li><%= link_to "Link3", "/path3"  %></li>
          <li>Welcome, <%= current_user.email %>!</li>
          </ul>
          <ul class="nav pull-right">
          <li><%= link_to "Log out", destroy_user_session_path, method: :delete %></li>
        <% else %>
          <ul class="nav pull-right">
          <li><%= link_to "Sign in", new_user_session_path %></li>
          <li><%= link_to "Sign up", new_user_registration_path %></li>
          <% end %>
         </ul>
      </div><!--/.nav-collapse -->
于 2014-02-18T09:32:50.423 回答
0

Pull-right 只是添加“float:right”。尝试将“pull-left”添加到以前的导航。

于 2012-12-19T13:23:31.527 回答