我有一篇文章“标签”侧边栏,它在主页上的位置正确,但在我的所有其他页面上都出现了。我正在使用 Kaminari 分页插件。这让我抓狂 - 我怎样才能阻止这种情况发生?
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>
最佳答案
设置'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;
}
关于css - 标签侧边栏向上移动?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/6102842/