index.scss 1.6 KB

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