sass-实现响应式

http://www.w3cplus.com/preprocessor/the-solution-to-media-queries-in-sass.html

banner.scss

.banner { 
    text-align: center; 
    font-size: 14px; 
} 
// 引入media-queries.scss 
@mixin banner--sm() { 
    .banner { 
        font-size: 20px; 
    } 
}
 @mixin banner--md() { 
    .banner { 
        text-align: left;
        font-size: 25px; 
    } 
}        

media-queries.scss

// small screen size (sm) 
@media (min-width: 801px) { 
    @include banner--sm(); 
} 

// medium screen size (md) 
@media (min-width: 992px) { 
    @include banner--md() 
}

 

posted @ 2017-05-06 15:49  Jesonhu  阅读(1817)  评论(0编辑  收藏  举报
Top