index.scss 2.1 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120
  1. // @import url(reset.css);
  2. @import "./reset.scss";
  3. // 变量
  4. /* 你好 */
  5. $a: #f00;
  6. $b: 50;
  7. $c: #ff0 !default;
  8. // 占位符
  9. // %placeholder => %
  10. %www {
  11. color: aquamarine;
  12. }
  13. // 基类
  14. .windy {
  15. color: #ff0;
  16. background-color: #f00;
  17. }
  18. @mixin sun {
  19. width: 200px;
  20. height: 300px;
  21. margin: 10px;
  22. // border-radius: 20px;
  23. border: 3px solid #00f;
  24. // box-shadow: 30px 20px 4px #f00;
  25. }
  26. @mixin rain($x) {
  27. border-radius: $x;
  28. }
  29. @mixin tea($x:$a) {
  30. background:$x;
  31. }
  32. @mixin box1($x...) {
  33. box-shadow: $x;
  34. // box-shadow: $x $q $w $r;
  35. // @if length($x) >= 3 {
  36. // box-shadow: $x;
  37. // } @else {
  38. // box-shadow: 30px 20px 4px plum;
  39. // }
  40. }
  41. @function xxx($a) {
  42. @return 200 * $a;
  43. }
  44. h1 {
  45. width: #{xxx(2)}px;
  46. // height: #{xxx(3)}px;
  47. // height: 200px - 10px;
  48. // height: 200px * 4;
  49. height: (200px / 2);
  50. // height: 200px + 200px;
  51. // color: $a !important;
  52. font-size: $b + px;
  53. background: #ff0 + #000;
  54. // @extend .windy;
  55. // @extend %www;
  56. // color: $vase;
  57. // @include sun;
  58. // @include rain(30px);
  59. // @include tea;
  60. // @include box1(30px 20px 4px plum)
  61. }
  62. // ul {
  63. // width: 400px;
  64. // height: 400px;
  65. // background: #ff0;
  66. // list-style: none;
  67. // }
  68. // ul li {
  69. // $d:#00f !global;
  70. // padding: 10px;
  71. // }
  72. // ul li a{
  73. // text-decoration: none;
  74. // color: #00f;
  75. // font-size: 30px;
  76. // }
  77. // ul li a:hover {
  78. // color: $a;
  79. // }
  80. ul {
  81. width: 400px;
  82. height: 400px;
  83. background: #ff0;
  84. list-style: none;
  85. @extend .windy;
  86. @include sun;
  87. li {
  88. $d: #00f !global;
  89. padding: 10px;
  90. a {
  91. text-decoration: none;
  92. color: #00f;
  93. // font-size: 30px;
  94. // font-weight: bold;
  95. font: {
  96. size: 40px;
  97. weight:bold
  98. }
  99. &:hover {
  100. color: $a;
  101. }
  102. }
  103. }
  104. }
  105. /*
  106. 混合宏
  107. @mixin 允许定义一个可以再整个样式表复制的样式
  108. @include 可以将mixin混入到整个样式表中
  109. */
  110. p {
  111. color: $d;
  112. }