Skip to content

Instantly share code, notes, and snippets.

@mohamnag
Last active August 29, 2015 14:13
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 mohamnag/e60ccbe3ee93432e7ca0 to your computer and use it in GitHub Desktop.
Save mohamnag/e60ccbe3ee93432e7ca0 to your computer and use it in GitHub Desktop.
Adds a shadowy border on top of the element using the :before pseudo element, you may apply the last three lines directly to the element itself if you dont need additional background on the same element.
@mixin shadow-border-top($size: 10px) {
&:before {
content: "";
width: 100%;
height: $size;
display: block;
top: 0;
position: absolute;
background: linear-gradient(to top, transparent 0%, rgba(0, 0, 0, 0.09) 75%, white 88%, white 100%) no-repeat;
background-position: 0 -$size / 2;
background-size: 100% $size;
}
}
@mixin shadow-border-bottom($size: 10px) {
&:after {
content: "";
width: 100%;
height: $size;
display: block;
bottom: 0;
position: absolute;
background: linear-gradient(to bottom, transparent 0%, rgba(0, 0, 0, 0.09) 75%, white 88%, white 100%) no-repeat;
background-position: 0 $size / 2;
background-size: 100% $size;
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment