我通常会将Twitter Bootstrap Rails宝石用于我的项目,但我想我会给Zurb Foundation宝石一个机会。我已按照安装instructions进行了信件。当我添加导航时:
<div class="row">
<div class="three columns">
<h1><img src="http://placehold.it/400x100&text=Logo" /></h1>
</div>
<div class="nine columns">
<ul class="nav-bar right">
<li><a href="#">About</a></li>
<li><a href="#">Work</a></li>
<li><a href="#">Contact</a></li>
</ul>
</div>
</div>
我得到以下内容:
请注意,徽标占位符未与右侧导航对齐,导航链接上没有灰色渐变。
我的application.html.erb看起来像这样:
<!DOCTYPE html>
<!-- paulirish.com/2008/conditional-stylesheets-vs-css-hacks-answer-neither/ -->
<!--[if lt IE 7 ]> <html class="ie6" lang="en"> <![endif]-->
<!--[if IE 7 ]> <html class="ie7" lang="en"> <![endif]-->
<!--[if IE 8 ]> <html class="ie8" lang="en"> <![endif]-->
<!--[if (gte IE 9)|!(IE)]><!--> <html lang="en"> <!--<![endif]-->
<head>
<meta charset="utf-8" />
<!-- Uncomment to make IE8 render like IE7 -->
<!-- <meta http-equiv="X-UA-Compatible" content="IE=7" /> -->
<!-- Set the viewport width to device width for mobile -->
<meta name="viewport" content="width=device-width, initial-scale=1.0" />
<title><%= content_for?(:title) ? yield(:title) : CONFIG['title'] %></title>
<!-- Included CSS Files -->
<%= stylesheet_link_tag "application" %>
<%= csrf_meta_tags %>
</head>
<body>
<%= render 'layouts/navigation' %>
<div class="container">
<%= yield %>
</div>
<!-- Included JS Files -->
<%= javascript_include_tag "application" %>
<% if CONFIG['google_analytics_id'] %>
<!-- Google Analytics -->
<script>
var _gaq=[['_setAccount','<%= CONFIG['google_analytics_id'] %>'],['_trackPageview']];
(function(d,t){var g=d.createElement(t),s=d.getElementsByTagName(t)[0];
g.src=('https:'==location.protocol?'//ssl':'//www')+'.google-analytics.com/ga.js';
s.parentNode.insertBefore(g,s)}(document,'script'));
</script>
<% end %>
</body>
</html>
答案 0 :(得分:1)
我通过更新Zurb Foundation gem并参考documentation来解决这个问题。我使用的是Zurb 2.X而不是3.X.
gem文件应包括:
gem 'compass-rails'
gem 'zurb-foundation', '~> 3.2.4'
application.scss现在应该有:
@import "foundation";
而不是:
*= require "foundation"