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 Skypack, which makes packages from npm not only available on a CDN, but prepares them for native JavaScript ES6 import
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.
<!--<iframe src="https://codepen.io/z-/posts/popular/" frameborder="0" width="200" height="200" style="position:absolute; top:9px; right:9px"></iframe>
<a href="https://codepen.io/z-/details/XPQyMo/#new-comment" target="_blank" id="widget-comment">Comment</a>-->
<p>Haii, what a complete mess this is. Yeah it needs improvement, you should have seen the first version though.</p>
<video width="64" height="64" autoplay style="border-radius:100%"><source src="https://i.koya.io/HyOVD4.mp4" type="video/mp4"></video>
@import url(https://pro.fontawesome.com/releases/v5.11.2/css/all.css);
:root {
//--user-button-main: #EC87C0;
//--user-button-background: #FFFFFF;
--user-button-circle: rgba(0,0,0,0.025);
--user-button-cardborder: rgba(255,255,255,0.25);
--user-button-text:#323133;
--user-button-shadow:rgba(0,0,0,0.1);
}
@mixin dark {
&.dark {
@content;
}
@media (prefers-color-scheme: dark) {
&:not(.light) {
@content;
}
}
}
body {
#user-button {
//position: fixed;
z-index:1000;
bottom:1rem !important;
right:1rem !important;
color:var(--user-button-text);
transition:1s 0s ease-out;
animation:slide 3s ease-out forwards;
//display:block !important;
@keyframes slide {
0%, 50% {
opacity:0;
display:block !important;
}
100% {
opacity:1;
display:block !important;
}
}
.u-card {
//background:var(--user-button-background, #FFFFFF);
border-radius:100%;
box-shadow:0 0 1rem -.25rem var(--user-button-shadow), inset 0 0 1rem -.75rem var(--user-button-shadow);
}
.u-main {
//position: relative;
//z-index:1000;
//display:grid;
//place-items:center;
//width:4rem;
//height:4rem;
cursor: pointer;
--user-button-background:var(--user-button-main, #EC87C0);
img {
//height:50%;
//width:50%;
height:100%;
width:100%;
}
iframe {
position: absolute;
top:0;
left:0;
width:4rem;
height:4rem;
opacity:1;
transition:0s 4s;
}
}
.u-icons {
position:relative;
z-index:950;
//position: absolute;
//top:50%;
//left:50%;
transform:translate(-50%, -50%);
//width:0%;
//height:0%;
background:var(--user-button-circle);
box-shadow:0 0 0 0.125rem var(--user-button-cardborder);
border-radius:100%;
transition:.25s;
opacity:1 !important;
backdrop-filter: blur(10px);
/*&:before {
z-index:-1;
position:absolute;
top:0; right:0; bottom:0; left:0;
content:'';
backdrop-filter: blur(10px);
}*/
a {
color:inherit;
display:grid;
place-items:center;
width:30px;
height:30px;
text-decoration:none;
div {
padding:.5rem;
//box-shadow: 0 0 0 0rem transparent;
//box-shadow:0 0 .5rem -.25rem var(--user-button-shadow);
transition:0s;
}
&[href="https://twitter.com/Osorpenke"] {
position:relative;
&:before {
content:'Middle Click';
position:absolute;
top:-1.5rem;
left:50%;
font-family: 'Segoe UI', Tahoma, Geneva, Verdana, sans-serif;
white-space:pre;
transform:translateX(-50%);
opacity:0;
pointer-events:none;
transition:.25s ease-in;
background:#fffc;
padding:.25rem .5rem;
border-radius:.25rem;
}
&.show {
&:before {
opacity:1;
transition:.25s ease-out;
}
}
div {
color:#1da1f2;
}
}
&[href="https://codepen.io/z-"] div {
background:black;
color:white;
//--user-button-cardborder:var(--user-button-text);
}
&:hover {
//box-shadow: 0 0 0rem 0.125rem var(--user-button-cardborder);
}
&.u-random {
div {
position:relative;
top:-1px;
animation:diespin 2s linear infinite;
@keyframes diespin {
0% {
transform:rotate(0deg);
}
100% {
transform:rotate(360deg);
}
}
}
&:not(:hover) div {
animation-play-state:paused;
}
}
}
>* {
position: absolute;
width:30px;
height:30px;
background:var(--singlecolour);
border-radius:100%;
cursor: pointer;
transform:translate(-50%,-50%);
transition:.25s -.05s;
&:before {
position: absolute;
top:50%;
left:50%;
transform:translate(-50%,-50%);
}
&:hover, &:focus-within {
background:var(--hcolour);
}
&:first-child:nth-last-child(1),
&:first-child:nth-last-child(1) ~ * { //If there are 3 children
&:nth-child(1) {
left:25%;
top:25%;
}
}
&:first-child:nth-last-child(2),
&:first-child:nth-last-child(2) ~ * { //If there are 4 children
&:nth-child(1) {
left:37.5%;
top:18.75%;
}
&:nth-child(2) {
left:18.75%;
top:37.5%;
}
}
&:first-child:nth-last-child(3),
&:first-child:nth-last-child(3) ~ * { //If there are 3 children
&:nth-child(1) {
left:50%;
top:15.625%;
}
&:nth-child(2) {
left:25%;
top:25%;
}
&:nth-child(3) {
left:15.625%;
top:50%;
}
}
&:first-child:nth-last-child(4),
&:first-child:nth-last-child(4) ~ * { //If there are 4 children
&:nth-child(1) {
left:62.5%;
top:18.75%;
}
&:nth-child(2) {
left:37.5%;
top:18.75%;
}
&:nth-child(3) {
left:18.75%;
top:37.5%;
}
&:nth-child(4) {
left:18.75%;
top:62.5%;
}
}
}
}
&:hover, &:focus-within {
.u-icons {
width:300% !important;
height:300% !important;
}
}
}
}
let pen_socialbutton_items = ["ZEzMpdj", "ZEzMpdj", "ZEzMpdj","ZEzMpdj", "LYPqaME", "OBPJKK", "KKPeOPm", "qBWVMop", "PoYepvR", "bpxgWZ", "evxZpZ", "MJKNJZ", "XPQyMo", "JXVpgp", "YNPaaQ", "QmXOOR", "MQRGOe", "zBLGYN", "mGGPXj", "VEZvdg", "XNQaym", "oXpWbd", "oPOVOL", "bqjBMv", "bvpprw", "oaWdOm", "bvgWrO", "ZMbLNM", "eZQKEr", "xywaoW", "yKOMmV", "YNyKpd", "ygNVYM", "QpwZqJ", "rNBZZqv", "gPmNwv", "pJjOGW", "Kxygqv", "QyBKvW", "azVXym", "obyLPe", "dNKKOw", "VPLgaV", "pNZzMg", "qJNRaL", "yNvKpp", "wgwdzr", "WNeEgZx", "LYPBQvW", "GRgZExW", "YzPxWyW", "LYEjxyG", "dyRjmmV", "ZEydQPx", "wvBEOYj", "abzegbx", "gOpvGwV", "GRJvoJR", "bGNKmBR", "ZEYoKBw", "WNbMjEW","wvBPvby","zYxdRQy","dyzyNQX","vYdyGOm","XWZgZxx","YzeYjbK"];
let pen_socialbutton_num = ["one", "two", "three", "four", "five", "six"];
let pen_socialbutton_randomItem = `<a class="u-random" href="https://codepen.io/z-/details/${pen_socialbutton_items[Math.floor(Math.random() * pen_socialbutton_items.length)]}" target="_blank" style="background:white"><div class="u-card fas fa-dice-${pen_socialbutton_num[Math.floor(Math.random() * pen_socialbutton_num.length)]}"></div></a>`
let pen_socialbutton_theme_needed = document.body.parentNode.classList.contains(`theme_switchable`);// (new URL(window.location.href)).searchParams?.get(`theme`) != undefined; //REMOVE
let pen_socialbutton_theme = pen_socialbutton_theme_needed ? (window.matchMedia(`(prefers-color-scheme: dark)`).matches ? `dark` : `light` ) : `none`;
document.body.className = pen_socialbutton_theme
//document.getElementById(`theme_status`).innerHTML = `${theme_needed} : ${theme}`;
let pen_socialbutton_theme_buttons = {
none: {},
light: {
style:`border:none; background:#323133; color:white;`,
innerHTML:`<i class="fas fa-lightbulb-slash"></i>`,
title:`Use dark theme`
},
dark:{
style:`border:none; background:white; color:#323133;`,
innerHTML:`<i class="fas fa-lightbulb-on"></i>`,
title:`Use light theme`
}
}
var pen_socialbutton_button = pen_socialbutton_button || false;
const pen_socialbutton_theme_switch = () => {
const el = document.getElementById(`theme_button`);
pen_socialbutton_theme = pen_socialbutton_theme == `dark` ? `light` : `dark`;
el.setAttribute(`style`, pen_socialbutton_theme_buttons[pen_socialbutton_theme].style)
el.setAttribute(`title`, pen_socialbutton_theme_buttons[pen_socialbutton_theme].title)
el.innerHTML = pen_socialbutton_theme_buttons[pen_socialbutton_theme].innerHTML
document.body.className = pen_socialbutton_theme
}
let pen_socialbutton_re_hide_notification_timeout = null;
if(window.location.href.indexOf("fullcpgrid") == -1 /*Small on pages*/ && window.location.href.indexOf("debug") /*...debug, mentioned for whenever I forget how to read code*/ == -1 && window.location.href.indexOf("fullembedgrid") == -1 /*Focused/details*/) { //Don't show on these pages
/*document.body.innerHTML +=
`<link href="https://codepen.io/z-/pen/a8e37caf2a04602ea5815e5acedab458.css" rel="stylesheet"><div style=position:fixed;bottom:-5rem;right:-5rem; id=user-button><div class=u-icons style=position:absolute;z-index:950;top:50%;left:50%;width:0;height:0%;opacity:0;><a href=https://twitter.com/Osorpenke target=_blank><div class="u-card fab fa-twitter"></div></a><a href=https://codepen.io/z- target=_blank><div class="u-card fab fa-codepen"></div></a>${randomItem}</div><div class="u-card u-main"style=position:relative;z-index:1000;width:4rem;height:4rem;display:grid;place-items:center;background:var(--user-button-background)><img alt=""style="height:100%; width:100%;"src=https://s3-us-west-2.amazonaws.com/s.cdpn.io/199011/happy.svg>${button?`<iframe frameborder=0 src=https://codepen.io/z-/posts/></iframe>`:``}</div></div>` */
/*document.body.innerHTML +=
`<link href="https://codepen.io/z-/pen/a8e37caf2a04602ea5815e5acedab458.css" rel="stylesheet"><div style=position:fixed;bottom:-5rem;right:-5rem; id=user-button><div class=u-icons style=position:absolute;z-index:950;top:50%;left:50%;width:0;height:0%;opacity:0;><a href=https://twitter.com/Osorpenke target=_blank><div class="u-card fab fa-twitter"></div></a><a href=https://codepen.io/z- target=_blank><div class="u-card fab fa-codepen"></div></a>${randomItem}${theme_needed ? `<a id="theme_button" onclick="theme_switch()" style="${theme_buttons[theme].style}" title="${theme_buttons[theme].title}">${theme_buttons[theme].innerHTML}</button>` : ``}</div><div class="u-card u-main"style=position:relative;z-index:1000;width:4rem;height:4rem;display:grid;place-items:center;background:var(--user-button-background)><a href="https://codepen.io/z-" target="_blank"><iframe alt=""style="height:200%; width:200%; transform: translate(-25%, -25%) scale(0.5); border-radius:100%; border:none;"src="https://cdpn.io/z-/debug/4677c6bd4703f7a7f95eab9764b71812"></iframe></a></div></div>` //https://codepen.io/z-/pen*/
document.body.innerHTML +=
`<link href="https://codepen.io/z-/pen/a8e37caf2a04602ea5815e5acedab458.css" rel="stylesheet"><div style=position:fixed;bottom:-5rem;right:-5rem; id=user-button><div class=u-icons style=position:absolute;z-index:950;top:50%;left:50%;width:0;height:0%;opacity:0;><a id="socialbutton-twitter" href="https://twitter.com/Osorpenke" target=_blank rel="no-refer"><div class="u-card fab fa-twitter"></div></a><a href=https://codepen.io/z- target=_blank><div class="u-card fab fa-codepen"></div></a>${pen_socialbutton_randomItem}${pen_socialbutton_theme_needed ? `<a id="theme_button" onclick="pen_socialbutton_theme_switch()" style="${pen_socialbutton_theme_buttons[pen_socialbutton_theme].style}" title="${pen_socialbutton_theme_buttons[pen_socialbutton_theme].title}">${pen_socialbutton_theme_buttons[pen_socialbutton_theme].innerHTML}</button>` : ``}</div><div class="u-card u-main"style=position:relative;z-index:1000;width:4rem;height:4rem;display:grid;place-items:center;background:var(--user-button-background)><a href="https://codepen.io/z-" target="_blank"><img src="https://i.koya.io/S70jhQ.webp" style="border-radius:100%; width:64px; height:64px;"/></a></div></div>` //https://codepen.io/z-/pen/37f471adc6c5dba134cac86a34c93a61
// setTimeout(() => {
// const twitter = document.getElementById(`socialbutton-twitter`);
// twitter.addEventListener(`click`, e => {
// e.preventDefault();
// clearTimeout(pen_socialbutton_re_hide_notification_timeout);
// twitter.classList.add(`show`);
// pen_socialbutton_re_hide_notification_timeout =
// setTimeout(() => {
// twitter.classList.remove(`show`);
// },1000)
// })
// },1000)
}//https://i.imgur.com/DZ3sYcD.png
//fullcpgrid/a8e37caf2a04602ea5815e5acedab458
Also see: Tab Triggers