Sass mixin for background transparency back to IE8

前端 未结 3 1597
刺人心
刺人心 2021-01-30 18:15

I\'m new to Sass and struggling with this. I can\'t get the color to render in both hex (for IE) and rgba. Every little piece is frustrating me becau

3条回答
  •  被撕碎了的回忆
    2021-01-30 18:50

    I think I encountered a similar problem when I wanted to pass a url to the mixin. Instead of sending only the url I had the send the whole url parameter as a parameter to the mixin. If you understand what I mean?

    example:

    @mixin bg($url)
      background: #000 $url repeat-x
    

    insted of:

    @mixin bg($url)
      background: #000 url($url) repeat-x
    

    Also, this might not the suited for your application, but I usually work around that problem using opacity:

    @mixin transparent_bg($hex, $a){
      /* for IEGR8 */
      filter:alpha(opacity=$a)
      zoom: 1;
    
      /* for modern browsers */
      background-color: $hex;
      opacity: ($a*10)
    }
    

提交回复
热议问题