For effective clipping effects, a font that has bold lettering and thick strokes tends to work best.
Created
July 21, 2015 01:32
-
-
Save iamnewton/20b873351e307a10bdd3 to your computer and use it in GitHub Desktop.
Cross-Browser Text Masks with Blend Modes
This file contains hidden or 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
.dark { | |
background-image: url(image.jpg); | |
background-size: cover; | |
text-align: center; | |
h1 { | |
margin: 0; | |
background-color: rgb(0,0,0); | |
color: rgb(255,255,255); | |
font-family: Montserrat, sans-serif; | |
font-size: 20vw; | |
line-height: 1.9; | |
text-transform: uppercase; | |
mix-blend-mode: darken; | |
} | |
} | |
.reversal { | |
position: relative; | |
background: rgb(0,0,0); | |
h1 { | |
mix-blend-mode: none; | |
} | |
img { | |
position: absolute; | |
top: 0; | |
left: 0; | |
width: 100%; | |
mix-blend-mode: darken; | |
} | |
} |
This file contains hidden or 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
<!-- Text takes precedence over image --> | |
<div class="dark"> | |
<h1>Text</h1> | |
</div | |
<!-- Image takes precedence over text --> | |
<div class="dark reversal"> | |
<h1>Text</h1> | |
<img src="image.jpg" alt="" /> | |
</div> |
This file contains hidden or 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
.dark { | |
background-image: url(image.jpg); | |
background-size: cover; | |
text-align: center; | |
} | |
.dark h1 { | |
margin: 0; | |
background-color: rgb(0,0,0); | |
color: rgb(255,255,255); | |
font-family: Montserrat, sans-serif; | |
font-size: 20vw; | |
line-height: 1.9; | |
text-transform: uppercase; | |
} | |
.reversal { | |
position: relative; | |
background: rgb(0,0,0); | |
} | |
.reversal h1 { | |
mix-blend-mode: none; | |
} | |
.reversal img { | |
position: absolute; | |
top: 0; | |
left: 0; | |
width: 100%; | |
mix-blend-mode: darken; | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment