使用sass的媒体查询 [英] Media queries with sass

查看:1928
本文介绍了使用sass的媒体查询的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我收到使用媒体查询混合编译我的sass文件的错误。我按照几个教程,但它不会编译。我使用 Sass 3.3.0.alpha.67(Bleeding Edge)

I'm getting errors compiling my sass files using media query mixins. I followed several tutorials, but it won't compile. I'm using Sass 3.3.0.alpha.67 (Bleeding Edge).

/* Included at the end */
@mixin mobile-only {
    @media (max-width : 320px) {
        @content;
    }
}

/* Included where the rest of my sass is */
body { @include mobile-only { 
            display: none; 
    } 
}

我使用scout来编译和监视更改。还有什么我需要做的吗?

I'm using scout to compile and watch for changes. Is there anything else I need to be doing?

推荐答案

似乎不再是一个问题了。在此代码中 http://codepen.io/danielcgold中说明了略为修改的代码 / pen / RRNrPQ

Doesn't seem to be an issue anymore. The slightly modified code is explained in this codepen http://codepen.io/danielcgold/pen/RRNrPQ.

@mixin start-desktop-size {
  @media (min-width: 1024px) {
    @content;
  }
}

body { 
  @include start-desktop-size { 
    background: red; 
  } 
}

这篇关于使用sass的媒体查询的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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