1

我的来源看起来像这样

<div class="navbar">
  <div class="navbar-inner">
    <div class="container">
      <ul class="nav">
        <a class="brand" href="#">Project name</a>

        <li><%= link_to 'Home', pages_home_path %></li>

        <li><%= link_to 'About', pages_about_path %></li>

        <li><%= link_to 'Contact Us', pages_contact_path %></li>




        <li class="nav pull-right">   
          <div id="user_nav">
            <% if user_signed_in? %>
            Signed in as <%= current_user.email %>. Not you?
            <%= link_to "Sign out", destroy_user_session_path, :method => :delete, :class => 'btn btn-danger btn-mini' %>
            <% else %>
            <%= link_to new_user_registration_path do %>
            <button class="btn-mini btn btn-info">Sign Up</button>
            <% end %>
            or <%= link_to new_user_session_path do %>
            <button class="btn btn-info btn-mini">Sign In</button>
            <% end %>
            <% end %>
          </div>
        </li>

      </ul>
    </div>
  </div>
</div>

.pull-right在我的用户登录/注销部分使用,但它只是向右移动了一点点,而不是向右移动,正如您在 twitter-bootstrap 原始页面中看到的那样。请让我知道我做错了什么。

4

1 回答 1

2

试试这个方法:

<div class="navbar">
  <div class="navbar-inner">
    <div class="container">
      <ul class="nav">
        <a class="brand" href="#">Project name</a>

        <li><%= link_to 'Home', pages_home_path %></li>

        <li><%= link_to 'About', pages_about_path %></li>

        <li><%= link_to 'Contact Us', pages_contact_path %></li>
      </ul>



      <ul class="nav pull-right">   
        <li>
          <div id="user_nav">
            <% if user_signed_in? %>
            Signed in as <%= current_user.email %>. Not you?
            <%= link_to "Sign out", destroy_user_session_path, :method => :delete, :class => 'btn btn-danger btn-mini' %>
            <% else %>
            <%= link_to new_user_registration_path do %>
            <button class="btn-mini btn btn-info">Sign Up</button>
            <% end %>
            or <%= link_to new_user_session_path do %>
            <button class="btn btn-info btn-mini">Sign In</button>
            <% end %>
            <% end %>
          </div>
        </li> 
      </ul>

    </div>
  </div>
</div>
于 2012-08-16T20:01:36.103 回答