Sass-在多值规则中使用变量

Sass-在多值规则中使用变量,sass,Sass,Sass变量可以这样使用: !blue = #3bbfce .content_navigation border-color = !blue color = !blue - #111 !blue = #3bbfce .content_navigation background= !blue "url(/path/to/image) 0 0 no-repeat" 这在“单值”变量上非常有效。我无法在“多值”css规则上使用它们,例如背景: !blue = #3bbfce /

Sass变量可以这样使用:

!blue = #3bbfce

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

.content_navigation
   background= !blue "url(/path/to/image) 0 0 no-repeat"
这在“单值”变量上非常有效。我无法在“多值”css规则上使用它们,例如背景:

!blue = #3bbfce

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

我如何做到这一点?

正确的税收应该是这样的:

!blue = #3bbfce

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

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

尽情享受吧

右边的sintax应该是这样的:

!blue = #3bbfce

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

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

尽情享受吧

接受的答案是旧的、不推荐使用的语法。看看新的Sass 3语法:

这将是Sass 3方式,使用缩进语法:

$blue: #3bbfce

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

接受的答案是旧的、不推荐的语法。看看新的Sass 3语法:

这将是Sass 3方式,使用缩进语法:

$blue: #3bbfce

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

谢谢,但我现在会坚持非测试版:)谢谢,但我现在会坚持非测试版:)这正是我想要的。谢谢这正是我想要的。谢谢