Skip to content

Instantly share code, notes, and snippets.

@jasonujmaalvis
Created December 30, 2015 23:18
Show Gist options
  • Select an option

  • Save jasonujmaalvis/86bdc40e7f5e1793f070 to your computer and use it in GitHub Desktop.

Select an option

Save jasonujmaalvis/86bdc40e7f5e1793f070 to your computer and use it in GitHub Desktop.
Generated by SassMeister.com.
// ----
// libsass (v3.3.2)
// ----
// Pseudo-elements placeholder
%pseudos {
display: block;
content: '';
position: absolute;
}
// Pseudo-elements mixin
@mixin p-el($el, $el-w: null, $el-h: null) {
@if $el == "before" or $el == "after" {
&:#{$el} {
@extend %pseudos;
width: $el-w;
height: $el-h;
@content;
}
}
@else {
@error "`#{$el}` is not a valid pseudo-element.";
}
}
.example {
@include p-el(before, 10px, 20px) {
background: grey;
top: 10px;
}
}
.example:before {
display: block;
content: '';
position: absolute;
}
.example:before {
width: 10px;
height: 20px;
background: grey;
top: 10px;
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment