Rails app:css无法按预期工作

时间:2017-01-31 14:14:15

标签: css ruby-on-rails

我尝试在基本的Rails应用程序中对我的html进行样式化。该应用程序加载home.scss文件,但我的标题样式不起作用。它似乎只有新的字体系列工作。对这个问题有什么看法吗?

我的application.html文件

<!DOCTYPE html>
<html>
  <head>
    <title>Content Style</title>
    <%= csrf_meta_tags %>
    <%= stylesheet_link_tag 'application', media: 'all', 'data-turbolinks-track' => true %>
  </head>

  <body>
    <header>
      <h1 id="logo">ContentStyle.co</h1>
      <% if notice %>
        <p class="alert alert-success"><%= notice %></p>
      <% end %>
      <% if alert %>
        <p class="alert alert-danger"><%= alert %></p>
      <% end %>
      <ul>
        <%= render 'devise/menu/registration_items' %>
        <%= render 'devise/menu/login_items' %>
      </ul>
    </header>
    <%= yield %>
    <%= javascript_include_tag 'application', 'data-turbolinks-track': 'reload' %>
    <%= yield :save_js %>
  </body>
</html>

我的home.scss文件

@import url('https://fonts.googleapis.com/css?family=Crete+Round');

body {
  font-family: 'Crete Round', serif;
}

header {
  width: 100%;
  height: 40px;
  padding: 20px 150px 20px 150px;
  background-color: #2C64C1;
}

#logo {
  color: white;
  font-size: 18px;
  font-weight: normal;
}

标题背景颜色应为蓝色,但这是它的外观(h1文本按预期显示为白色,因此我们不会看到它): enter image description here

0 个答案:

没有答案