Sass Mixin错误的IE特定的过滤器像-ms-filter ...需要语法帮助 [英] Sass Mixin Error for IE specific filters like -ms-filter... need syntax help please

查看:145
本文介绍了Sass Mixin错误的IE特定的过滤器像-ms-filter ...需要语法帮助的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我想要这样做一个按钮混音:

  = default_button $ b:border = 1px!lighter solid 
:background-color#e3e3e3
:background = -webkit-gradient(linear,0 0,0 100%,from(!lighter),to ))repeat-x,#d0581e
:background = -moz-linear-gradient(90deg,!darker,!lighter)repeat-x scroll 0 0#d0581e
:filter = progid:DXImageTransform.Microsoft .gradient(startColorstr ='!lighter',endColorstr ='!darker')
:-ms-filter =progid:DXImageTransform.Microsoft.gradient(startColorstr ='!lighter',endColorstr ='!darker')
:zoom 1
:margin 0 0 0 0
:width auto
:padding 2px 14px 2px 14px
:border-radius 10px
: webkit-border-radius 10px
:-moz-border-radius 10px
:color #FFF

当我编译sass时,我得到以-filter和-ms-filter开头的行的错误:


  SASS :: SyntaxError:预期的rparen令牌,为single_eq令牌


我很确定这是我的位置,但我不知道如何正确写。如果我传递十六进制值而不是!更轻,!darker,因为我可以删除=符号如下:

 :filter processid:DXImageTransform.Microsoft.gradient(startColorstr ='#F89F16',endColorstr ='#d0581e')
:-ms-filterprogid:DXImageTransform.Microsoft.gradient(startColorstr ='#F89F16' endColorstr ='#d0581e')

先感谢您的建议。

解决方案

这样解决,但仍在寻找最佳方式的替代建议...

  = default_button(!lighter,!darker)
text-shadow = 1px 1px 3px darken(!darker,8)
border = 1px!darker solid
background-color =!lighter
background = -webkit-gradient(linear,0 0,0 100%,from(!lighter),to(!darker))repeat-x,!darker
background = -moz-linear-gradient(90deg,!darker,!lighter)repeat-x scroll 0 0!darker
-ms-filter =progid:DXImageTransform.Microsoft.gradient(startColorstr ='# }',endColorstr ='#{!darker}')
:zoom 1
:margin 0 0 0 0
:width auto
/ pre>

Sass的语法已经更改,因为此回答最初发布。现在的sass(缩进)语法如下所示:

  = default_button($ lighter,$ darker)
text- shadow:1px 1px 3px darken($ darker,8)
border:1px $ darker solid
background-color:$ lighter
背景:-webkit-gradient(linear,0 0,0 100 %,从($ lighter)到($ darker))repeat-x,$ darker
背景:-moz-线性渐变(90deg,$ darker,$ lighter)repeat-x scroll 0 0 $ darker
-ms-filter:unquote(progid:DXImageTransform.Microsoft.gradient(startColorstr ='#{$ lighter}',endColorstr ='#{$ darker}'))
zoom:1
margin:0 0 0 0
width:auto


I'm trying to make a button mixin like this:

=default_button(!lighter, !darker) 
  :border= 1px !lighter solid
  :background-color #e3e3e3
  :background= -webkit-gradient(linear, 0 0, 0 100%, from(!lighter), to(!darker)) repeat-x, #d0581e
  :background= -moz-linear-gradient(90deg, !darker, !lighter) repeat-x scroll 0 0 #d0581e
  :filter= progid:DXImageTransform.Microsoft.gradient(startColorstr='!lighter', endColorstr='!darker')
  :-ms-filter= "progid:DXImageTransform.Microsoft.gradient(startColorstr='!lighter', endColorstr='!darker')"
  :zoom 1
  :margin 0 0 0 0
  :width auto
  :padding 2px 14px 2px 14px
  :border-radius 10px
  :-webkit-border-radius 10px
  :-moz-border-radius 10px
  :color #FFF

When I compile the sass, i get this error for the lines beginning with -filter and -ms-filter:

SASS::SyntaxError: Expected rparen token, was single_eq token

I'm pretty sure it's my placement of the ='s, but I'm not exactly sure how to write it correctly. It works if I pass the hex values instead of !lighter, !darker, because then I can remove the = sign like so:

:filter progid:DXImageTransform.Microsoft.gradient(startColorstr='#F89F16', endColorstr='#d0581e')
:-ms-filter "progid:DXImageTransform.Microsoft.gradient(startColorstr='#F89F16', endColorstr='#d0581e')"

Thanks in advance for your suggestions.

解决方案

Solved it like this, but still looking for alternative suggestions on the best way...

=default_button(!lighter, !darker) 
  text-shadow= 1px 1px 3px darken(!darker, 8)
  border= 1px !darker solid
  background-color= !lighter
  background= -webkit-gradient(linear, 0 0, 0 100%, from(!lighter), to(!darker)) repeat-x, !darker
  background= -moz-linear-gradient(90deg, !darker, !lighter) repeat-x scroll 0 0 !darker
  -ms-filter = "progid:DXImageTransform.Microsoft.gradient(startColorstr='#{!lighter}', endColorstr='#{!darker}')"
  :zoom 1
  :margin 0 0 0 0
  :width auto

The syntax for Sass has changed since this answer was originally posted. The modern sass (indented) syntax looks like this:

=default_button($lighter, $darker) 
  text-shadow: 1px 1px 3px darken($darker, 8)
  border: 1px $darker solid
  background-color: $lighter
  background: -webkit-gradient(linear, 0 0, 0 100%, from($lighter), to($darker)) repeat-x, $darker
  background: -moz-linear-gradient(90deg, $darker, $lighter) repeat-x scroll 0 0 $darker
  -ms-filter: unquote("progid:DXImageTransform.Microsoft.gradient(startColorstr='#{$lighter}', endColorstr='#{$darker}')")
  zoom: 1
  margin: 0 0 0 0
  width: auto

这篇关于Sass Mixin错误的IE特定的过滤器像-ms-filter ...需要语法帮助的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆