Sass - samidevjp/Tips GitHub Wiki
@function vw($size, $viewport: 375) {
$rate: 100 / $viewport;
@return $rate * $size * 1vw;
}
// ↑vw(15) のように記述する
//------------------------------
// Name : _variables.sass
// Description : 関数色々
//------------------------------
@mixin bg-img {
background-size: 100% auto;
background-position: center center;
background-repeat: no-repeat;
}
@mixin center {
display: block;
margin: 0 auto;
}
@mixin full-size {
display: block;
width: 100%;
height: 100%;
}
@mixin flex-center {
display: flex;
justify-content: center;
aline-items: center;
}
@mixin even() {
&:nth-child(even) {
@content;
}
}
@mixin odd() {
&:nth-child(odd) {
@content;
}
}
@mixin nth-num($num) {
&:nth-child($num) {
@content;
}
}
$pc: 1025px;
$tab: 600px;
@mixin tab {
@media screen and (min-width: $tab) {
@content;
}
}
@mixin pc {
@media screen and (min-width: $pc) {
@content;
}
}