Skip to content

Instantly share code, notes, and snippets.

@Razenbull
Last active August 29, 2015 14:27
Show Gist options
  • Save Razenbull/8aa68f9832096b6f9ec6 to your computer and use it in GitHub Desktop.
Save Razenbull/8aa68f9832096b6f9ec6 to your computer and use it in GitHub Desktop.
helper classes to remove padding or margin
// ----
// libsass (v3.2.5)
// ----
/**
*
* helper classes
* @use to remove padding or margin
*
* .no-padding, no-margin
* .no-padding-top, no-padding-right, no-padding-bottom, no-padding-left
* .no-margin-top, no-margin-right, no-margin-bottom, no-margin-left
* .no-padding-TB, .no-padding-RL
* .no-margin-TB, .no-margin-RL
*/
.no {
$properties: 'padding', 'margin';
$directions: 'top' 'right' 'bottom' 'left' 'TB' 'RL';
@for $property from 1 through length($properties) {
$property: nth($properties, $property);
&-#{$property} {
#{$property}: 0;
@for $direction from 1 through length($directions) {
$direction: nth($directions, $direction);
&-#{$direction} {
@if $direction != 'TB' and $direction != 'RL' {
#{$property}-#{$direction}: 0;
} @else if $direction == 'TB' {
#{$property}-top: 0;
#{$property}-bottom: 0;
} @else if $direction == 'RL' {
#{$property}-right: 0;
#{$property}-left: 0;
}
}
}
}
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment