Skip to content

Instantly share code, notes, and snippets.

@yuezk
Created November 2, 2015 07:57
Show Gist options
  • Save yuezk/2439ff25afa965905132 to your computer and use it in GitHub Desktop.
Save yuezk/2439ff25afa965905132 to your computer and use it in GitHub Desktop.
PostCSS one pixel border mixin
/**
* use the postcss-mixins plugin
*
* Usage:
* .item {
* position: relative;
* }
* .item:before {
* content: '';
* @mixin 1px top, #ddd;
* }
* .item:after {
* content: '';
* @mixin 1px bottom, #ddd;
* }
*/
@define-mixin 1px $direction: top, $color: #ccc {
position: absolute;
left: 0;
right: 0;
$(direction): 0;
height: 1px;
background: $color;
transform: scaleY(0.5);
transform-origin: $direction center;
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment