Skip to content

Instantly share code, notes, and snippets.

@tomfordweb
Created March 21, 2019 18:58
Show Gist options
  • Save tomfordweb/6e931f56c09f35f9f25c94ea1656e6ae to your computer and use it in GitHub Desktop.
Save tomfordweb/6e931f56c09f35f9f25c94ea1656e6ae to your computer and use it in GitHub Desktop.
SASS Mixin: Full Width Pseudo Elements
// adapted from
// https://css-tricks.com/full-browser-width-bars/
@mixin full-width-pseudo($bg, $pos: relative) {
/* negative offset = section padding */
margin: 0 -30px;
/* add back section padding value */
padding: 0.25rem 30px;
position: 'absolute';
background: $bg;
&:before, &:after {
content: "";
position: absolute;
/* fill vertically */
top: 0;
bottom: 0;
width: 9600px;
right: 100%;
background: $bg;
}
&:after {
width: 320px;
left: 100%;
/* you're free to do something totally different here */
background: $bg;
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment