Skip to content

Instantly share code, notes, and snippets.

@mio-U-M
mio-U-M / before-and-after-mixin.scss
Created February 22, 2020 17:07
擬似要素のテンプレで書くところを省略するためのmixin
@mixin simple-before {
&::before {
content: '';
@content;
}
}
@mixin simple-after {
&::after {
content: '';
@mio-U-M
mio-U-M / position-abs.scss
Created February 22, 2020 17:07
absoluteを指定する時いちいち全部書かなくていいようにしたものです
@mixin position-ab($top: auto, $right: auto, $bottom: auto, $left: auto) {
position: absolute;
margin: auto;
top: $top;
right: $right;
bottom: $bottom;
left: $left;
}
@mio-U-M
mio-U-M / position-ab-center2.scss
Last active March 26, 2020 07:11
position:absoluteで中央よせ
@mixin position-ab-center1 {
position: absolute;
top: 50%;
left: 50%;
transform: translate(-50%, -50%);
}
@mio-U-M
mio-U-M / image-url.scss
Created February 22, 2020 17:06
背景画像を取ってくるscss
$img_dir: '/img/';
@function image-url ($url) {
@return url("#{$img_dir}#{$url}");
}
// image-urlを使う想定
@mixin bg-contain($path) {
background-image: image-url($path);
background-repeat: no-repeat;
background-size: contain;
}
@mio-U-M
mio-U-M / size-scale-by-vw.scss
Created February 22, 2020 17:06
画面に応じて拡大縮小できるようにvwにして返してくれる
// size
$pc-min-width: 1440px;
$tablet_max_width: 769px;
$sp_max_width: 375px;
@function pSize($value) {
@return $value / $pc_min_width * 100 + vw;
}
@function tSize($value) {
@mio-U-M
mio-U-M / _function.styl
Created February 22, 2020 17:06
functions for stylus
/**
* 画像サイズを返してくれる。
* @param {String} パス
*/
img-size($path)
image-size($img_dir + $path)
/**
* 画像アスペクト比を返してくれる。
* @param {String} パス
@mio-U-M
mio-U-M / _mixin.styl
Last active February 22, 2020 17:09
mixin for stylus (補足) stylusを入れる時こいつを入れてやると強い http://kouto-swiss.io/ stylusの独自関数で結構使えるやつがある。ので、そいつらをつど使っていくと良い http://stylus-lang.com/
/**
* PC表示の時にのみ適用。
*/
pc-layout()
@media (min-width $pc_min_width)
{block}
/**
* SP表示の時にのみ適用。
*/
var easing = {
linear : function (t){
return t;
},
easeInQuad: function (t) {
return t*t;
},
easeOutQuad: function (t) {
return -1 *t*(t-2);
},
@mixin form-style-reset {
margin: 0;
padding: 0;
background: none;
border: none;
border-radius: 0;
outline: none;
-webkit-appearance: none;
-moz-appearance: none;
appearance: none;