【发布时间】:2014-10-23 07:58:40
【问题描述】:
我正在阅读关于将 CSS 编译到 Sass 的 ROR 教程,但我无法解决这个问题,这很神秘,我做了一些研究,这一切都无关紧要。非常感谢。
Invalid CSS after " }": expected selector or at-rule, was "}"
(in `/Users/snailwalker/rails_projects/sample_app/app/assets/stylesheets/custom.css.scss:82)`
Extracted source (around line #5):
2
3
4
5
6
7
8
<html>
<head>
<title><%= full_title(yield(:title)) %></title>
<%= stylesheet_link_tag "application", media: "all",
"data-turbolinks-track" => true %>
<%= javascript_include_tag "application", "data-turbolinks-track" => true %>
<%= csrf_meta_tags %>
CSS 文件。
@import "bootstrap";
/* universal */
html {
overflow-y: scroll;
}
body {
padding-top: 60px;
}
section {
overflow: auto;
}
textarea {
resize: vertical;
}
.center {
text-align: center;
h1 {
margin-bottom: 10px;
}
}
/* typography */
h1, h2, h3, h4, h5, h6 {
line-height: 1;
}
h1 {
font-size: 3em;
letter-spacing: -2px;
margin-bottom: 30px;
text-align: center;
}
h2 {
font-size: 1.2em;
letter-spacing: -1px;
margin-bottom: 30px;
text-align: center;
font-weight: normal;
color: #999;
}
p{
font-size: 1.1em; line-height: 1.7em;
}
/* header */
#logo {
float: left;
margin-right: 10px;
font-size: 1.7em;
color: #fff;
text-transform: uppercase;
letter-spacing: -1px;
padding-top: 9px;
font-weight: bold;
line-height: 1;
&:hover {
color: #fff;
text-decoration: none;
}
}
/* footer */
footer {
margin-top: 45px;
padding-top: 5px;
border-top: 1px solid #eaeaea;
color: #999;
}
footer a {
color: #555;
&:hover {
color: #222;
}
}
footer small {
float: left;
}
footer ul {
float: right;
list-style: none;
}
footer ul li {
float: left;
margin-left: 10px;
}
}
}
【问题讨论】:
-
去掉
}的最后两行。 -
非常感谢,它成功了,但是为什么呢?教程书上有两行。我很困惑。
-
使用适当的文本缩进来查看选择器的深度。可能是教程中的错误或缺少某个部分。
-
请注意,通过 CSS 验证器运行它会为您发现错误。
标签: css ruby-on-rails sass