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.
<button type="button">
<i>
<svg viewBox="0 0 56 50" fill="none" xmlns="http://www.w3.org/2000/svg">
<path d="M9.3999 44.0002V39.2102C9.3999 39.2102 14.2299 38.9702 14.2299 34.3802V19.1002C14.2299 19.1002 14.1799 6.43018 27.8599 6.43018C39.9199 6.43018 42.8599 13.4302 42.8599 18.6402V35.2302C42.8599 35.2302 42.4999 39.2302 47.6599 39.2302V44.0002H9.3999Z" stroke="black" stroke-width="3" stroke-dasharray="0,0,109.7099609375,27.427490234374993">
<animate attributeType="XML" attributeName="stroke-dasharray" repeatCount="indefinite" dur="1.4705882352941178s" values="0,0,109.7099609375,27.427490234374993;
0,27.427490234374993,109.7099609375,0;
109.7099609375,27.427490234374993,0,0" keyTimes="0; 0.19999999999999996; 1"></animate>
</path>
<path d="M32.24 6.78998V5.46998C32.24 4.47807 31.846 3.52679 31.1446 2.8254C30.4432 2.12402 29.4919 1.72998 28.5 1.72998C27.5081 1.72998 26.5568 2.12402 25.8554 2.8254C25.154 3.52679 24.76 4.47807 24.76 5.46998V6.66998" stroke="black" stroke-width="3" stroke-dasharray="0,0,11.415697479248047,2.853924369812011">
<animate attributeType="XML" attributeName="stroke-dasharray" repeatCount="indefinite" dur="1.4705882352941178s" values="0,0,11.415697479248047,2.853924369812011;
0,2.853924369812011,11.415697479248047,0;
11.415697479248047,2.853924369812011,0,0" keyTimes="0; 0.19999999999999996; 1"></animate>
</path>
<path d="M32.33 44C32.275 45.1738 31.77 46.2812 30.92 47.0925C30.0699 47.9037 28.94 48.3563 27.7649 48.3563C26.5899 48.3563 25.46 47.9037 24.6099 47.0925C23.7599 46.2812 23.2549 45.1738 23.2 44" stroke="black" stroke-width="3" stroke-dasharray="0,0,11.143664550781251,2.785916137695312">
<animate attributeType="XML" attributeName="stroke-dasharray" repeatCount="indefinite" dur="1.4705882352941178s" values="0,0,11.143664550781251,2.785916137695312;
0,2.785916137695312,11.143664550781251,0;
11.143664550781251,2.785916137695312,0,0" keyTimes="0; 0.19999999999999996; 1"></animate>
</path>
<path d="M46.5 26.4902C47.2034 26.7872 47.8233 27.2522 48.3053 27.8444C48.7874 28.4366 49.1168 29.138 49.2649 29.887C49.4129 30.6361 49.375 31.4101 49.1545 32.1411C48.934 32.8721 48.5376 33.538 48 34.0802" stroke="black" stroke-width="3" stroke-dasharray="0,0,7.293882751464844,1.8234706878662106">
<animate attributeType="XML" attributeName="stroke-dasharray" repeatCount="indefinite" dur="1.4705882352941178s" values="0,0,7.293882751464844,1.8234706878662106;
0,1.8234706878662106,7.293882751464844,0;
7.293882751464844,1.8234706878662106,0,0" keyTimes="0; 0.19999999999999996; 1"></animate>
</path>
<path d="M49.3 23C50.5062 23.5068 51.5697 24.3017 52.3973 25.315C53.2249 26.3283 53.7913 27.5292 54.0469 28.8123C54.3026 30.0954 54.2396 31.4216 53.8636 32.6747C53.4875 33.9279 52.8099 35.0696 51.89 36" stroke="black" stroke-width="3" stroke-dasharray="0,0,12.497595977783204,3.1243989944458">
<animate attributeType="XML" attributeName="stroke-dasharray" repeatCount="indefinite" dur="1.4705882352941178s" values="0,0,12.497595977783204,3.1243989944458;
0,3.1243989944458,12.497595977783204,0;
12.497595977783204,3.1243989944458,0,0" keyTimes="0; 0.19999999999999996; 1"></animate>
</path>
<path d="M9.99992 26.7402C9.29398 27.0343 8.67126 27.4976 8.1867 28.0892C7.70214 28.6808 7.37062 29.3826 7.22141 30.1327C7.07219 30.8827 7.10985 31.6579 7.33108 32.39C7.5523 33.122 7.95028 33.7884 8.48992 34.3302" stroke="black" stroke-width="3" stroke-dasharray="0,0,7.304747772216797,1.8261869430541988">
<animate attributeType="XML" attributeName="stroke-dasharray" repeatCount="indefinite" dur="1.4705882352941178s" values="0,0,7.304747772216797,1.8261869430541988;
0,1.8261869430541988,7.304747772216797,0;
7.304747772216797,1.8261869430541988,0,0" keyTimes="0; 0.19999999999999996; 1"></animate>
</path>
<path d="M7.17011 23.2598C5.96393 23.7666 4.90046 24.5615 4.07288 25.5748C3.2453 26.5881 2.67887 27.7889 2.42324 29.072C2.1676 30.3552 2.23056 31.6814 2.6066 32.9345C2.98263 34.1876 3.66026 35.3294 4.58011 36.2598" stroke="black" stroke-width="3" stroke-dasharray="0,0,12.497511291503907,3.1243778228759758">
<animate attributeType="XML" attributeName="stroke-dasharray" repeatCount="indefinite" dur="1.4705882352941178s" values="0,0,12.497511291503907,3.1243778228759758;
0,3.1243778228759758,12.497511291503907,0;
12.497511291503907,3.1243778228759758,0,0" keyTimes="0; 0.19999999999999996; 1"></animate>
</path>
</svg>
</i>
<span>
<p>
3
</p>
<svg viewBox="0 0 74 74" fill="none" xmlns="http://www.w3.org/2000/svg">
<circle cx="37" cy="37" r="36" stroke="#7afffb" stroke-width="2" stroke-dasharray="0,0,0,0,0,225.8292694091797">
<animate attributeType="XML" attributeName="stroke-dasharray" repeatCount="indefinite" dur="5.43653642049062s" values="0,0,0,0,0,225.8292694091797;
0,0,0,45.59790218816986,89.0355628446701,91.19580437633972;
0,0,75.27642313639323,0,150.55284627278647,225.8292694091797;
0,0,150.55284627278647,0,75.27642313639323,225.8292694091797;
0,0,188.19105784098306,37.63821156819662,0,0;
0,225.8292694091797,0,75.27642313639323,0,225.8292694091797" keyTimes="0; 0.16666666666666666; 0.3333; 0.6666; 0.8333; 1" begin="0.935907495683864s"></animate>
</circle>
</svg>
</span>
<svg viewBox="0 0 74 74" fill="none" xmlns="http://www.w3.org/2000/svg">
<circle cx="37" cy="37" r="36" stroke="black" stroke-width="2" stroke-dasharray="0,0,0,0,0,225.8292694091797">
<animate attributeType="XML" attributeName="stroke-dasharray" repeatCount="indefinite" dur="5.43653642049062s" values="0,0,0,0,0,225.8292694091797;
0,0,0,45.59790218816986,89.0355628446701,91.19580437633972;
0,0,75.27642313639323,0,150.55284627278647,225.8292694091797;
0,0,150.55284627278647,0,75.27642313639323,225.8292694091797;
0,0,188.19105784098306,37.63821156819662,0,0;
0,225.8292694091797,0,75.27642313639323,0,225.8292694091797" keyTimes="0; 0.16666666666666666; 0.3333; 0.6666; 0.8333; 1" begin="0.935907495683864s"></animate>
</circle>
</svg>
</button>
<aside>
hover & click me
</aside>
* {
box-sizing: border-box;
}
body,
html {
overflow: hidden;
}
body {
position: relative;
display: flex;
flex-direction: column;
align-items: center;
justify-content: center;
width: 100vw;
height: 100vh;
margin: 0;
background: black;
color: #ccc;
}
button {
position: relative;
width: 100px;
height: 100px;
background-image: linear-gradient(
120deg,
#7afffb,
#79fcff,
#75eaff,
#6eccff,
#67a4ff,
#5f73ff,
#7156ff,
#9b4eff,
#c547ff,
#e940ff,
#ff3cfc,
#ff3bf2
);
background-position: top left;
background-size: 100%;
box-shadow: 0px 0px 400px rgba(255, 59, 242, 1),
0px 0px 200px rgba(255, 59, 242, 0.75), 0px 0px 100px rgba(255, 59, 242, 0.5),
0px 0px 50px rgba(255, 59, 242, 0.35), 0px 0px 25px rgba(255, 59, 242, 0.2);
border-radius: 100%;
border: none;
margin: 0;
padding: 15px;
display: flex;
flex-direction: column;
align-items: center;
justify-content: center;
cursor: pointer;
transition: all 0.3s ease;
}
button:hover {
box-shadow: 0px 0px 400px rgba(122, 255, 251, 1),
0px 0px 200px rgba(122, 255, 251, 0.75),
0px 0px 100px rgba(122, 255, 251, 0.5), 0px 0px 50px rgba(122, 255, 251, 0.35),
0px 0px 25px rgba(122, 255, 251, 0.2);
padding: 20px;
background-size: 180%;
transition: all 0.3s ease;
}
button:active {
transform: scale(0.9);
transition: all 0.05s ease;
}
button::before {
position: absolute;
width: calc(100% + 20px);
height: calc(100% + 20px);
border: 1px solid rgba(255, 59, 242, 0.8);
border-radius: 100%;
pointer-events: none;
content: "";
transition: all 0.3s ease;
}
button:hover::before {
border: 1px solid rgba(122, 255, 251, 0.6);
width: calc(100% + 40px);
height: calc(100% + 40px);
transition: all 0.3s ease;
}
button:active::before {
width: calc(100% + 20px);
height: calc(100% + 20px);
transition: all 0.07s ease;
}
button::after {
position: absolute;
width: calc(100% + 40px);
height: calc(100% + 40px);
border: 2px dashed rgba(255, 59, 242, 0.4);
box-shadow: 0px 0px 100px rgba(122, 255, 251, 0.1);
border-radius: 100%;
pointer-events: none;
animation: rotate 30s linear infinite;
content: "";
transition: all 0.3s ease;
}
@keyframes rotate {
to {
transform: rotateZ(-360deg);
}
}
button:hover::after {
border: 2px dashed rgba(122, 255, 251, 0.3);
width: calc(100% + 80px);
height: calc(100% + 80px);
transition: all 0.3s ease;
}
button:active::after {
width: calc(100% + 40px);
height: calc(100% + 40px);
transition: all 0.07s ease;
}
button > svg {
position: absolute;
top: 0;
left: 0;
width: 100%;
height: 100%;
z-index: 2;
mix-blend-mode: overlay;
transition: all 0.3s ease;
z-index: 1;
}
button i {
width: 100%;
height: 100%;
display: flex;
flex-direction: column;
align-items: center;
justify-content: center;
}
button i svg {
position: relative;
width: 100%;
height: auto;
filter: drop-shadow(0px 0px 5px white);
mix-blend-mode: overlay;
}
button:hover i svg {
animation: shake 0.5s linear infinite;
}
@keyframes shake {
0% {
transform: rotate(0deg);
}
25% {
transform: rotate(15deg);
}
75% {
transform: rotate(-15deg);
}
}
button span {
position: absolute;
top: -7px;
right: -11px;
width: 40px;
height: 40px;
border-radius: 100%;
background-color: rgba(0, 0, 0, 0.3);
backdrop-filter: blur(5px);
color: white;
display: flex;
flex-direction: column;
align-items: center;
justify-content: center;
transition: all 0.3s ease;
z-index: 2;
}
button:hover span {
background-color: #333;
transition: all 0.3s ease;
}
button span p {
font: normal normal 400 14pt / 2cap "Roboto Mono", monospace;
color: #ccc;
margin: 0;
position: relative;
left: 1px;
}
button span svg {
position: absolute;
top: 0;
left: 0;
width: 100%;
height: 100%;
}
aside {
position: absolute;
font: normal normal 900 14pt / 2cap "Architects Daughter", cursive;
bottom: 10%;
color: #777;
transition: all 0.3s ease;
}
button:hover ~ aside {
opacity: 0;
transition: all 0.3s ease;
}
@media (max-height: 270px) {
aside {
display: none;
}
}
Also see: Tab Triggers