媒体查询+scss 响应式开发

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
```bash
$color:#3497ee;
@mixin opacity($value) {
    opacity: $value;
    filter: alpha(opacity=$value*100);
}
 
@mixin transition($obj, $time) {
    -webkit-transition: $obj $time;
    -moz-transition: $obj $time;
    -ms-transition: $obj $time;
    transition: $obj $time;
}
 
@mixin transform($value) {
    -webkit-transform: $value;
    -moz-transform: $value;
    -ms-transform: $value;
    transform: $value;
}
 
//$attr 属性  $val 值  $steps 每次减少的值
@mixin space($attr,$val,$steps:2) {
    #{$attr}:$val;
  @media only screen and (max-width: 1200px) {
    #{$attr}:$val - $steps;
  }
  @media only screen and (max-width: 992px) {
    #{$attr}:$val - $steps*2;
  }
  @media only screen and (max-width: 768px) {
    #{$attr}:$val - $steps*3;
  }
  @media only screen and (max-width: 520px) {
    #{$attr}:$val - $steps*4;
  }
  @media only screen and (max-width: 420px) {
    #{$attr}:$val - $steps*5;
  }
}
//例子
.box{
    background-color:red;
    @include space(padding-top,24px);
    @include space(font-size,24px)
}
posted @   黑白棋学弟  阅读(74)  评论(0编辑  收藏  举报
相关博文:
阅读排行:
· 全程不用写代码,我用AI程序员写了一个飞机大战
· MongoDB 8.0这个新功能碉堡了,比商业数据库还牛
· 记一次.NET内存居高不下排查解决与启示
· 白话解读 Dapr 1.15:你的「微服务管家」又秀新绝活了
· DeepSeek 开源周回顾「GitHub 热点速览」
历史上的今天:
2022-10-08 用CSS绘制最常见的40种形状和图形
点击右上角即可分享
微信分享提示