index.scss 1.6 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109
  1. $aa: blue;
  2. $bb: 2px solid #f00;
  3. $cc: 400 !default;
  4. // $dd: purple !global;
  5. $dd: purple !important;
  6. // 这是h2标签的样式
  7. /* 哈哈哈哈 */
  8. // @import url(reset.css);
  9. @import './reset.scss';
  10. h2 {
  11. width: $cc + px;
  12. height: 300px;
  13. color: $dd;
  14. color: $aa;
  15. border: $bb;
  16. }
  17. ul {
  18. li {
  19. color: red;
  20. &:first-child {
  21. color: #0f0;
  22. }
  23. font: {
  24. size: 40px;
  25. weight: bold;
  26. };
  27. }
  28. }
  29. // 不带参的混合宏
  30. // @mixin x {
  31. // color: #f00;
  32. // background: #ff0;
  33. // border-radius: 20px;
  34. // }
  35. // .one {
  36. // width: $cc + px;
  37. // height: $cc + px;
  38. // @include x;
  39. // }
  40. // 带参混合宏
  41. // (带参 不带值)
  42. // @mixin x($cccc) {
  43. // color: #f00;
  44. // background: #ff0;
  45. // border-radius: $cccc + px;
  46. // }
  47. // .one {
  48. // width: $cc + px;
  49. // height: $cc + px;
  50. // @include x(50);
  51. // }
  52. // // (带参 带值)
  53. // @mixin x($cccc:50%) {
  54. // color: #f00;
  55. // background: #ff0;
  56. // border-radius: $cccc;
  57. // }
  58. // .one {
  59. // width: $cc + px;
  60. // height: $cc + px;
  61. // @include x;
  62. // }
  63. // 带参 多值
  64. // @mixin x($c...) {
  65. // color: #f00;
  66. // background: #ff0;
  67. // border-radius: 20px;
  68. // box-shadow: $c;
  69. // }
  70. // .one {
  71. // width: $cc + px;
  72. // height: $cc + px;
  73. // @include x(55px 40px 30px blue);
  74. // }
  75. // 继承
  76. // 基类
  77. // .vase {
  78. // font-size: 30px;
  79. // color: #0f0;
  80. // }
  81. // .one {
  82. // width: $cc + px;
  83. // height: $cc + px;
  84. // @extend .vase;
  85. // }
  86. // 占位符
  87. // %
  88. %yy {
  89. color: #f00;
  90. font-style: italic;
  91. font-weight: 700;
  92. }
  93. .one {
  94. @extend %yy;
  95. }