Navigation Menu

Skip to content

Instantly share code, notes, and snippets.

@CodeMyUI
Created March 6, 2017 13:17
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 CodeMyUI/f386f3182436b36004b086a23a4cd6f0 to your computer and use it in GitHub Desktop.
Save CodeMyUI/f386f3182436b36004b086a23a4cd6f0 to your computer and use it in GitHub Desktop.
[webkit] Animated "text-shadow" pattern
<h1 data-shadow='dang!'>dang!</h1>
@import url(http://fonts.googleapis.com/css?family=Righteous);
*, *:before, *:after {
margin: 0;
padding: 0;
box-sizing: border-box;
position: relative;
}
html, body {
height: 100%;
}
body {
text-align: center;
background-color: hsla(230,40%,50%,1);
}
body:before {
content: '';
display: inline-block;
vertical-align: middle;
font-size: 0;
height: 100%;
}
h1 {
display: inline-block;
color: white;
font-family: 'Righteous', serif;
font-size: 12em;
text-shadow: .03em .03em 0 hsla(230,40%,50%,1);
}
h1:after {
content: attr(data-shadow);
position: absolute;
top: .06em; left: .06em;
z-index: -1;
text-shadow: none;
background-image:
linear-gradient(
45deg,
transparent 45%,
hsla(48,20%,90%,1) 45%,
hsla(48,20%,90%,1) 55%,
transparent 0
);
background-size: .05em .05em;
-webkit-background-clip: text;
-webkit-text-fill-color: transparent;
animation: shad-anim 15s linear infinite;
}
@keyframes shad-anim {
0% {background-position: 0 0}
0% {background-position: 100% -100%}
}

[webkit] Animated "text-shadow" pattern

Uses -webkit-background-clip: text & linear-gradient to simulate striped text shadow.

A Pen by carpe numidium on CodePen.

License.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment