Skip to content

Instantly share code, notes, and snippets.

@WebDevLuke
Last active August 16, 2018 11:19
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save WebDevLuke/1a2117c302d659e37d31e688db18e115 to your computer and use it in GitHub Desktop.
Save WebDevLuke/1a2117c302d659e37d31e688db18e115 to your computer and use it in GitHub Desktop.
Bootstrap Spacing Utilities - Disable for last child
//------------------------------------------------------------------------------------------------
// SPACING LAST CHILD
//------------------------------------------------------------------------------------------------
/*
Extends Bootstraps spacing utility classes to create modifier classes
for margin/padding bottom which disable spacing only if the element in question
is last-child.
This is useful, as when you're using these classes with dynamically
generated content, it allows you to disable the margin for the
last item, as that can sometimes result in too much spacing when combined
with the spacing of its parent.
*/
// stylelint-disable declaration-no-important
// Margin and Padding
@each $prop, $abbrev in (margin: m, padding: p) {
.#{$abbrev}b-lc:last-child {
#{$prop}-bottom: 0 !important;
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment