写CSS的常用套路·续
3D 方块 如何在 CSS 中创建立体的方块呢?用以下的 SCSS mixin 即可 方块的长度、高度、深度都可以通过 CSS 变量自由调节 @mixin cube($width, $height, $depth) { &__front { @include cube-front($width, $height, $depth); } &__back { @include cube-back($width, $height, $depth); } &__right { @include cube-right($width, $height, $depth); } &__left { @include cube-left($width, $height, $depth); } &__top { @include cube-top($width, $height, $depth); } &__bottom { @include cube-bottom($width, $height, $depth); } .face { position: absolute; } } @mixin cube-front($width, $height, $depth) { width: var($width); height: var($height); transform-origin: