Last active
July 2, 2019 17:23
-
-
Save jimratliff/062ef5b3cef1557ed994aae73ee6ff8a to your computer and use it in GitHub Desktop.
WebKit bug? `background-clip:var(--a)` invalidates `-webkit-background-clip:text` for Safari/Chrome
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
/* | |
* WebKit bug? `background-clip:var(--a)` invalidates `-webkit-background-clip:text` for Safari/Chrome | |
* Works in Firefox | |
*/ | |
p { | |
background: linear-gradient(to right, red, blue); | |
color: rgba(0,0,0,0.3); | |
font: bold 400% sans-serif; | |
padding: .5em; | |
/* This works fine in all browsers: the gradient appears only through the clipped text */ | |
-webkit-background-clip: text; | |
background-clip: text; | |
} | |
p + p { | |
/* The following—which should be equivalent—doesn't work in Safari/Chrome, but works in Firefox */ | |
--a: text; | |
-webkit-background-clip: text; | |
background-clip: var(--a); | |
} |
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
<p>background-clip: text; | |
<p>background-clip: var(--a); |
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
// alert('Hello world!'); |
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
{"view":"split","fontsize":"100","seethrough":"","prefixfree":"","page":"all"} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment