Skip to content

Instantly share code, notes, and snippets.

@NickGard
Created November 2, 2015 20:22
Show Gist options
  • Save NickGard/341a91af8ae311c0cea5 to your computer and use it in GitHub Desktop.
Save NickGard/341a91af8ae311c0cea5 to your computer and use it in GitHub Desktop.
Animating the content attribute

Animating the content attribute

In most browsers this is just going to show the letter 'A' but in the latest version of Chrome it should animate between 'A' and 'B'.

Not sure how useful this might be in the future, but it seems pretty cool!

A Pen by Robin Rendle on CodePen.

License.

<div class="element"></div>
@keyframes changeLetter {
0% {
content: "A";
}
50% {
color: white;
}
100% {
content: "B";
}
}
.element {
display: flex;
align-items: center;
justify-content: center;
min-height: 100vh;
&:after {
animation: changeLetter 3s linear infinite alternate;
display: block;
content: "A";
font-size: 80px;
}
}
body {
font-family: Georgia, serif;
display: flex;
height: 100%;
justify-content: center;
align-items: center;
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment