A CodePen by Rachel Nabors. Text Clipping Sass mixin - Based on Divya Manian's pure CSS background clipping solution. Now you can clip text to your heart's content without fear of disappearing text in non-webkit browsers!
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<h1>Hello!</h1> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
/* The background clip for text mixin */ | |
/* Based on Divya's pure CSS solution: http://nimbupani.com/using-background-clip-for-text-with-css-fallback.html */ | |
@mixin clip-text($img-url, $color: #000) { | |
color: $color; | |
-webkit-text-fill-color: transparent; | |
background: -webkit-linear-gradient(transparent, transparent), | |
url($img-url) repeat; | |
background: -o-linear-gradient(transparent, transparent); | |
-webkit-background-clip: text; | |
} | |
/* The mixin in action... */ | |
h1 { | |
@include clip-text("http://stash.rachelnabors.com/codepen/text-clip-mixin/cloth.jpg", #fff); | |
font-family: OstrichSansBlack; | |
font-size: 5em; | |
margin: 2em 0; | |
text-align: center; | |
} | |
/* Other Styles */ | |
body { background: #444; } |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment