2014-05-24 171 views
0

以前嵌套悬停不工作

#item_1, #item_2, #item_3 { 
    display: inline-block; 
    width: 57px; 
    padding-top: 11px; 
    padding-bottom: 11px; 
    text-decoration: none; 
} 

#item_1:hover, #item_2:hover, #item_3:hover { 
    color: #fff; 
} 

#item_1, #item_2, #item_3 { 
    display: inline-block; 
    width: 57px; 
    padding-top: 11px; 
    padding-bottom: 11px; 
    text-decoration: none; 
    &:hover { 
     color: #fff; 
    } 
} 

离开HTML一样,该版本的作品前,后的版本没有。我建立一个Rails应用程序使用Rails 4

+1

结束SASS? – Adrift

+0

我不知道。我只创建了一个Rails应用程序,并正在使用CSS。如果默认是SASS,那么是的。 – megashigger

+0

@ user2469211你甚至不知道后面的版本是SASS时尚的?看起来这就是为什么它不起作用。 –

回答

0

是款式供红宝石库

请参阅文档sass install

例如

#main { 
    color: black; 
    a { 
    font-weight: bold; 
    &:hover { color: red; } 
    } 
} 
is compiled to: 

#main { 
    color: black; } 
    #main a { 
    font-weight: bold; } 
    #main a:hover { 
     color: red; } 
0

这听起来像你要么不您的应用程序中安装了SASS,或者您使用的样式表不在正确的目录中。

检查,如果它的安装

检查您的Gemfile类似的东西,以

# Use SCSS for stylesheets 
gem 'sass-rails', '~> 4.0.0' 

添加并运行bundle install形成你的项目目录,如果它不是在那里。

检查,如果你的样式表是在正确的地方

导航到

app > assets > stylesheets 

,看看是否存在application.css.scss

如果这样做,确保那里有一条线,看起来像:

*= require_tree . 

如果有,请确保您的代码样式表是在stylesheets文件夹,您是否正在对.css.scss