Skip to content

Instantly share code, notes, and snippets.

@jimratliff
Last active July 2, 2019 17:23
Show Gist options
  • Save jimratliff/062ef5b3cef1557ed994aae73ee6ff8a to your computer and use it in GitHub Desktop.
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
/*
* 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);
}
<p>background-clip: text;
<p>background-clip: var(--a);
// alert('Hello world!');
{"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