2010-04-19 28 views
1

薩斯變量可以像這樣使用:薩斯 - 多值規則中使用的變量

!blue = #3bbfce 

.content_navigation 
    border-color = !blue 
    color = !blue - #111 

這工作得非常好於「單值」的變量。我無法在「多值」css規則中使用它們,例如背景:

!blue = #3bbfce 

//this doesn't work 
.content_navigation 
    background =!blue url(/path/to/image) 0 0 no-repeat 

我該如何做?

回答

0

正確sintax應該是這樣的:

!blue = #3bbfce 

.content_navigation 
    background= !blue "url(/path/to/image) 0 0 no-repeat" 

享受SASS!

+0

這正是我想要的。謝謝! – kikito 2010-04-19 14:47:10

4

接受的答案是舊的,不贊成使用的語法。看看新的Sass 3語法:

http://nex-3.com/posts/94-haml-sass-3-beta-released

這將是無禮3方式,使用縮進語法:

$blue: #3bbfce 

.content_navigation 
    background: $blue url(/path/to/image) 0 0 no-repeat 
+0

謝謝,但我現在堅持使用非beta版:) – kikito 2010-04-19 14:45:48

+0

Sass 3現已發佈:http://nex-3.com/posts/101-haml-sass-3-released – 2010-05-11 20:27:01