标签边栏向上移动?

时间:2011-05-23 20:47:32

标签: css ruby-on-rails-3

我有一个文章'标签'侧边栏,它正确定位在主页上,但在我的所有其他页面上爬行。我正在使用Kaminari paginate插件。它让我疯狂 - 我怎么能阻止这种情况发生?

CSS

.sidebar {
position:absolute;
width: 150px;
float:right;
padding: 0px 0px 0px 20px;
margin: -1500px 0px 0px 700px;
}   

_side.html.erb

 <div id="art">
 <%= link_to 'Post An Article', new_article_path %>
</div>

<div id="iphone">
<%= image_tag "iPhone.png" %>
</div>
<br />

<div id="soc-med">
<%= link_to image_tag("facebook.png"), "http://www.facebook.com/" %>
<%= link_to image_tag ("twitter.png"), "http://twitter.com/#!/" %>
</div>


<div id="tag_title">  
<h3>Article Tags</h3>
</div>

<div id= "tags" >
<% cache('all_tags') do %>   
<% for tag in Tag.find(:all, :order => 'name') %>


<ul style="list-style-type: none">
 <li>
<%= link_to "#{tag.name}", tag_path(tag) %>
</li>
</ul>

<% end %>
</div>
<% end %>
</div>

enter image description here

1 个答案:

答案 0 :(得分:0)

设置'top:130px;'属性解决了这个问题:

.sidebar {
font-family:Arial, Helvetica, sans-serif;
position:absolute;
width: 150px;
float:right;
top: 130px;
padding: 0px 0px 0px 20px;
margin: 0px 0px 0px 700px;
}