css - 标签侧边栏向上移动?

标签 css ruby-on-rails-3

我有一篇文章“标签”侧边栏,它在主页上的位置正确,但在我的所有其他页面上都出现了。我正在使用 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>

enter image description here

最佳答案

设置'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/

相关文章:

html - 如何在 html 的导航菜单中间居中标题文本

ruby-on-rails-3 - Rails 3.1 postgresql 将空白射入数据库

ruby-on-rails-3 - Rails 3 - Heroku PGError : ERROR: type modifier is not allowed for type "text"

ruby-on-rails - 在登录时设计一个 session 变量

ruby-on-rails - Rails 如何通过将 form_for 放在 .each 循环中来获得多种形式?

ruby-on-rails-3 - 是否有 gem 可以从 SCSS 文件生成图表?

html - 从 html 表格单元格中删除顶部边框

javascript - 属性 'addEvent' 的值为 null 或未定义,不是 Function 对象

javascript - svg "use"标签显示一个颠倒的 svg 图标

javascript - jQuery QuickFit 调整不适合 div 的文本大小