HTML preprocessors can make writing HTML more powerful or convenient. For instance, Markdown is designed to be easier to write and read for text documents and you could write a loop in Pug.
In CodePen, whatever you write in the HTML editor is what goes within the <body>
tags in a basic HTML5 template. So you don't have access to higher-up elements like the <html>
tag. If you want to add classes there that can affect the whole document, this is the place to do it.
In CodePen, whatever you write in the HTML editor is what goes within the <body>
tags in a basic HTML5 template. If you need things in the <head>
of the document, put that code here.
The resource you are linking to is using the 'http' protocol, which may not work when the browser is using https.
CSS preprocessors help make authoring CSS easier. All of them offer things like variables and mixins to provide convenient abstractions.
It's a common practice to apply CSS to a page that styles elements such that they are consistent across all browsers. We offer two of the most popular choices: normalize.css and a reset. Or, choose Neither and nothing will be applied.
To get the best cross-browser support, it is a common practice to apply vendor prefixes to CSS properties and values that require them to work. For instance -webkit-
or -moz-
.
We offer two popular choices: Autoprefixer (which processes your CSS server-side) and -prefix-free (which applies prefixes via a script, client-side).
Any URLs added here will be added as <link>
s in order, and before the CSS in the editor. You can use the CSS from another Pen by using its URL and the proper URL extension.
You can apply CSS to your Pen from any stylesheet on the web. Just put a URL to it here and we'll apply it, in the order you have them, before the CSS in the Pen itself.
You can also link to another Pen here (use the .css
URL Extension) and we'll pull the CSS from that Pen and include it. If it's using a matching preprocessor, use the appropriate URL Extension and we'll combine the code before preprocessing, so you can use the linked Pen as a true dependency.
JavaScript preprocessors can help make authoring JavaScript easier and more convenient.
Babel includes JSX processing.
Any URL's added here will be added as <script>
s in order, and run before the JavaScript in the editor. You can use the URL of any other Pen and it will include the JavaScript from that Pen.
You can apply a script from anywhere on the web to your Pen. Just put a URL to it here and we'll add it, in the order you have them, before the JavaScript in the Pen itself.
If the script you link to has the file extension of a preprocessor, we'll attempt to process it before applying.
You can also link to another Pen here, and we'll pull the JavaScript from that Pen and include it. If it's using a matching preprocessor, we'll combine the code before preprocessing, so you can use the linked Pen as a true dependency.
Search for and use JavaScript packages from npm here. By selecting a package, an import
statement will be added to the top of the JavaScript editor for this package.
Using packages here is powered by esm.sh, which makes packages from npm not only available on a CDN, but prepares them for native JavaScript ESM usage.
All packages are different, so refer to their docs for how they work.
If you're using React / ReactDOM, make sure to turn on Babel for the JSX processing.
If active, Pens will autosave every 30 seconds after being saved once.
If enabled, the preview panel updates automatically as you code. If disabled, use the "Run" button to update.
If enabled, your code will be formatted when you actively save your Pen. Note: your code becomes un-folded during formatting.
Visit your global Editor Settings.
<div class="rewards">
<svg id="trophy" xmlns="http://www.w3.org/2000/svg" width="24" height="24" viewBox="0 0 24 24"><path d="M19 1c0 9.803-5.094 13.053-5.592 17h-2.805c-.498-3.947-5.603-7.197-5.603-17h14zm-7.305 13.053c-1.886-3.26-2.635-7.432-2.646-11.053h-1.699c.205 4.648 1.99 8.333 4.345 11.053zm1.743 4.947h-2.866c-.202 1.187-.63 2.619-2.571 2.619v1.381h8v-1.381c-1.999 0-2.371-1.432-2.563-2.619zm7.08-1.596c-1.402-.634-2.609-.19-3.354.293.745-.484 1.603-1.464 1.595-3.003-2.591 1.038-2.295 2.496-2.765 3.345-.315.571-1.007.274-1.007.274l-.213.352c.365.193.989.319 1.716.319 1.307 0 2.949-.409 4.028-1.58zm2.444-4.022c-1.382.097-2.118 1.061-2.501 1.763.383-.702.614-1.942-.05-3.158-1.61 1.929-.752 2.958-.762 3.831-.004.427-.49.417-.49.417l.007.404c.314-.041 3.154-.717 3.796-3.257zm1.036-3.87c-1.171.426-1.56 1.473-1.718 2.175.158-.702.041-1.863-.835-2.75-.915 2.068.082 2.745.29 3.503.102.371-.325.606-.325.606l.29.179c.061-.029 2.385-1.332 2.298-3.713zm-.2-3.792c-.903.666-1.017 1.688-.974 2.335-.042-.646-.395-1.639-1.376-2.182-.264 2.018.769 2.349 1.142 2.95.182.294.023.658.023.658l.284-.019s.026-.127.169-.442c.291-.644 1.255-1.334.732-3.3zm-1.901-2.72s-.273.984-.045 1.732c.244.798.873 1.361.873 1.361s.34-.873.099-1.733c-.222-.792-.927-1.36-.927-1.36zm-12.67 15.665l-.213-.352s-.691.297-1.007-.274c-.47-.849-.174-2.307-2.765-3.345-.008 1.539.85 2.52 1.595 3.003-.745-.484-1.952-.927-3.354-.293 1.078 1.171 2.721 1.581 4.028 1.581.727-.001 1.35-.127 1.716-.32zm-4.393-2.027l.007-.404s-.486.01-.49-.417c-.009-.873.848-1.901-.762-3.831-.664 1.216-.433 2.457-.05 3.158-.383-.702-1.12-1.666-2.501-1.763.642 2.541 3.482 3.217 3.796 3.257zm-2.533-3.413l.29-.179s-.427-.236-.325-.606c.208-.758 1.205-1.435.29-3.503-.876.887-.994 2.048-.835 2.75-.158-.702-.546-1.749-1.718-2.175-.088 2.381 2.236 3.684 2.298 3.713zm-1.366-4.204c.143.315.169.442.169.442l.284.019s-.159-.364.023-.658c.373-.601 1.405-.933 1.142-2.95-.983.542-1.335 1.534-1.377 2.181.042-.647-.072-1.67-.974-2.335-.523 1.966.441 2.656.733 3.301zm.241-4.661c-.24.86.099 1.733.099 1.733s.629-.563.873-1.361c.228-.748-.045-1.732-.045-1.732s-.705.568-.927 1.36z"/></svg>
<div class="glow"></div>
<div class="particles">
<div class="rotate">
<div class="angle">
<div class="size">
<div class="position">
<div class="pulse">
<div class="particle">
</div>
</div>
</div>
</div>
</div>
<div class="angle">
<div class="size">
<div class="position">
<div class="pulse">
<div class="particle">
</div>
</div>
</div>
</div>
</div>
<div class="angle">
<div class="size">
<div class="position">
<div class="pulse">
<div class="particle">
</div>
</div>
</div>
</div>
</div>
</div>
</div>
</div>
body {
background: #111;
background: black;
}
.glow {
position: absolute;
top: calc(50% - 100px);
left: calc(50% - 100px);
width: 200px;
height: 200px;
border-radius: 50%;
-webkit-animation: glow 15s linear 0s infinite forwards;
background: url('https://t0.rbxcdn.com/182160a5d7d68c6d4be14a6d9f9e5598');
background-size: contain;
}
.particles {
position: absolute;
top: calc(50% - 50px);
left: calc(50% - 50px);
width: 100px;
height: 100px;
}
.rotate {
position: absolute;
top: calc(50% - 5px);
left: calc(50% - 5px);
width: 10px;
height: 10px;
}
.angle {
position: absolute;
top: 0;
left: 0;
}
.size {
position: absolute;
top: 0;
left: 0;
}
.position {
position: absolute;
top: 0;
left: 0;
}
.pulse {
position: absolute;
top: 0;
left: 0;
}
.particle {
position: absolute;
top: calc(50% - 5px);
left: calc(50% - 5px);
width: 30px;
height: 30px;
/* background: url('https://t0.rbxcdn.com/182160a5d7d68c6d4be14a6d9f9e5598'); */
background: url('http://www.officialpsds.com/images/thumbs/shine-light-bright-psd43123.png');
background-size: contain;
}
.rotate {
-webkit-animation: rotate 20s linear 0s infinite alternate;
}
.pulse{
-webkit-animation: pulse 1.5s linear 0s infinite alternate;
}
@-webkit-keyframes glow {
0% {
transform: scale(1) rotate(0deg);
filter: brightness(150%) saturate(50%) hue-rotate(0deg) opacity(100%);
}
25% {
transform: scale(0.8) rotate(90deg);
filter: brightness(100%) saturate(50%) hue-rotate(50deg) opacity(100%);
}
50% {
transform: scale(1) rotate(180deg);
filter: brightness(100%) saturate(100%) hue-rotate(0deg) opacity(100%);
}
75% {
transform: scale(0.8) rotate(270deg);
filter: brightness(100%) saturate(50%) hue-rotate(50deg) opacity(100%);
}
100% {
transform: scale(1) rotate(360deg);
filter: brightness(150%) saturate(100%) hue-rotate(0deg) opacity(100%);
}
}
@-webkit-keyframes rotate {
0% {
-webkit-transform: rotate(0deg);
}
100% {
-webkit-transform: rotate(360deg);
}
}
@-webkit-keyframes angle {
0% {
-webkit-transform: rotate(0deg);
}
100% {
-webkit-transform: rotate(360deg);
}
}
@-webkit-keyframes size {
0% {
-webkit-transform: scale(.2);
}
100% {
-webkit-transform: scale(.6);
}
}
@-webkit-keyframes position {
0% {
-webkit-transform: translate3d(0,0,0);
opacity: 1;
}
50 %{
opacity: 1;
}
100% {
-webkit-transform: translate3d(100px,100px,0);
opacity: 0;
}
}
@-webkit-keyframes pulse {
0% {
-webkit-transform: scale(1);
}
100% {
-webkit-transform: scale(.5);
}
}
@-webkit-keyframes particle {
from {
transform: scale(1);
filter: brightness(200%) hue-rotate(0deg);
}
to {
transform: scale(1.1);
filter: brightness(100%) hue-rotate(50deg);
}
}
.rotate .angle:nth-child(1){
/* change the angle every 2 seconds */
-webkit-animation: angle 10s steps(5) 0s infinite;
}
.rotate .angle:nth-child(1) .size{
/* change the size of the particle every 2 seconds */
-webkit-animation: size 10s steps(5) 0s infinite;
}
.rotate .angle:nth-child(1) .particle{
/* animate the glow and change the color every 2 seconds */
-webkit-animation: particle 6s linear infinite alternate;
}
.rotate .angle:nth-child(1) .position{
/* animate the fly out of the particle and its fade out at the end */
-webkit-animation: position 2s linear 0s infinite;
}
.rotate .angle:nth-child(2){
/* change the angle every 2 seconds */
-webkit-animation: angle 4.95s steps(3) -1.65s infinite;
}
.rotate .angle:nth-child(2) .size{
/* change the size of the particle every 2 seconds */
-webkit-animation: size 4.95s steps(3) -1.65s infinite alternate;
}
.rotate .angle:nth-child(2) .particle{
/* animate the glow and change the color every 2 seconds */
-webkit-animation: particle 4.95s linear -3.3s infinite alternate;
}
.rotate .angle:nth-child(2) .position{
/* animate the fly out of the particle and its fade out at the end */
-webkit-animation: position 1.65s linear 0s infinite;
}
.rotate .angle:nth-child(3){
/* change the angle every 2 seconds */
-webkit-animation: angle 13.76s steps(8) -6.88s infinite;
}
.rotate .angle:nth-child(3) .size{
/* change the size of the particle every 2 seconds */
-webkit-animation: size 6.88s steps(4) -5.16s infinite alternate;
}
.rotate .angle:nth-child(3) .particle{
/* animate the glow and change the color every 2 seconds */
-webkit-animation: particle 5.16s linear -1.72 infinite alternate;
}
.rotate .angle:nth-child(3) .position{
/* animate the fly out of the particle and its fade out at the end */
-webkit-animation: position 1.72s linear 0s infinite;
}
.rotate .angle:nth-child(5) .position{
/* animate the fly out of the particle and its fade out at the end */
-webkit-animation: position 2.45s linear 0s infinite;
}
#trophy {
position: absolute;
transform: translateX(-50%) translateY(-50%) scale(3);
left: 50%;
top: 50%;
z-index: 999;
}
#trophy path {
stroke: #ffe34c;
fill: #ffe34c;
}
Also see: Tab Triggers