Skip to content

Instantly share code, notes, and snippets.

@syahrasi
Last active September 10, 2018 18:24
Show Gist options
  • Save syahrasi/5092653 to your computer and use it in GitHub Desktop.
Save syahrasi/5092653 to your computer and use it in GitHub Desktop.
OOCSS Space Helpers
/*
https://github.com/stubbornella/oocss/blob/master/core/spacing/space.css
p,m = padding,margin
a,t,r,b,l,h,v = all,top,right,bottom,left,horizontal,vertical
s,m,l,n = small(5px),medium(10px),large(20px),none(0px)
*/
.ptn, .pvn, .pan { padding-top: 0px !important; }
.pts, .pvs, .pas { padding-top: 5px !important; }
.ptm, .pvm, .pam { padding-top: 10px !important; }
.ptl, .pvl, .pal { padding-top: 20px !important; }
.prn, .phn, .pan { padding-right: 0px !important; }
.prs, .phs, .pas { padding-right: 5px !important; }
.prm, .phm, .pam { padding-right: 10px !important; }
.prl, .phl, .pal { padding-right: 20px !important; }
.pbn, .pvn, .pan { padding-bottom: 0px !important; }
.pbs, .pvs, .pas { padding-bottom: 5px !important; }
.pbm, .pvm, .pam { padding-bottom: 10px !important; }
.pbl, .pvl, .pal { padding-bottom: 20px !important; }
.pln, .phn, .pan { padding-left: 0px !important; }
.pls, .phs, .pas { padding-left: 5px !important; }
.plm, .phm, .pam { padding-left: 10px !important; }
.pll, .phl, .pal { padding-left: 20px !important; }
.mtn, .mvn, .man { margin-top: 0px !important; }
.mts, .mvs, .mas { margin-top: 5px !important; }
.mtm, .mvm, .mam { margin-top: 10px !important; }
.mtl, .mvl, .mal { margin-top: 20px !important; }
.mrn, .mhn, .man { margin-right: 0px !important; }
.mrs, .mhs, .mas { margin-right: 5px !important; }
.mrm, .mhm, .mam { margin-right: 10px !important; }
.mrl, .mhl, .mal { margin-right: 20px !important; }
.mbn, .mvn, .man { margin-bottom: 0px !important; }
.mbs, .mvs, .mas { margin-bottom: 5px !important; }
.mbm, .mvm, .mam { margin-bottom: 10px !important; }
.mbl, .mvl, .mal { margin-bottom: 20px !important; }
.mln, .mhn, .man { margin-left: 0px !important; }
.mls, .mhs, .mas { margin-left: 5px !important; }
.mlm, .mhm, .mam { margin-left: 10px !important; }
.mll, .mhl, .mal { margin-left: 20px !important; }
.mra, .mha { margin-right: auto !important; }
.mla, .mha { margin-left: auto !important; }
// Sass v3.2.6
/*
https://github.com/stubbornella/oocss/blob/master/core/spacing/space.css
p,m = padding,margin
a,t,r,b,l,h,v = all,top,right,bottom,left,horizontal,vertical
s,m,l,n = small(5px),medium(10px),large(20px),none(0px)
*/
$n: 0px;
$s: 5px;
$m: $s * 2;
$l: $m * 2;
$type: p padding, m margin;
$top: t v a;
$right: r h a;
$bottom: b v a;
$left: l h a;
$dirs: top $top, right $right, bottom $bottom, left $left;
$size: n $n, s $s, m $m, l $l;
@each $t in $type {
@each $d in $dirs {
@each $s in $size {
.#{nth($t,1)}#{nth(nth($d,2),1)}#{nth($s,1)}, .#{nth($t,1)}#{nth(nth($d,2),2)}#{nth($s,1)}, .#{nth($t,1)}#{nth(nth($d,2),3)}#{nth($s,1)}{
#{nth($t,2)}-#{nth($d,1)}: #{nth($s,2)} !important;
}
}
}
}
.mra,.mha{margin-right:auto !important}
.mla,.mha{margin-left:auto !important}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment