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="illustration-pro public">
<div class="light">
<svg class="light-shine" width="289" height="227" viewBox="0 0 289 227" fill="none" xmlns="http://www.w3.org/2000/svg"><path opacity="0.3" d="M207 0H233L289 93V227H0L207 0Z" fill="url(#paint0_linear)"/><linearGradient id="paint0_linear" x1="228" y1="6.95594e-07" x2="226" y2="227" gradientUnits="userSpaceOnUse">
<stop stop-color="#FFE348"/>
<stop offset="1" stop-color="#FFE348" stop-opacity="0"/></linearGradient>
</svg>
<svg class="light-blub" width="36" height="53" viewBox="0 0 36 53" fill="none" xmlns="http://www.w3.org/2000/svg"><path d="M35.0333 34.9999C35.0333 44.6649 27.1983 52.4999 17.5333 52.4999C7.86834 52.4999 0.0333252 44.6649 0.0333252 34.9999C0.0333252 30.5978 1.65871 26.5753 4.34209 23.4999C6.08704 21.5 8.5 16.0001 8.5 9.5C8.5 9.5 6.64242 9.75798 6.5 8.5C7.5 6 7.9598 4.31835 10.5 0C12.3608 1.19391e-05 21.6804 -7.8835e-06 24 0C27.5 7.5 29.5 9.5 26.0333 9.5C26.0333 17 28.9796 21.5 30.7246 23.4999C33.4079 26.5753 35.0333 30.5978 35.0333 34.9999Z" fill="#968836"/>
</svg>
<svg class="light-filament" width="19" height="29" viewBox="0 0 19 29" fill="none" xmlns="http://www.w3.org/2000/svg"><path d="M6.5 1V23V25.5C6.5 26.8807 5.38071 28 4 28V28C2.61929 28 1.5 26.8807 1.5 25.5V25.5C1.5 24.1193 2.61929 23 4 23H12.5H15C16.3807 23 17.5 24.1193 17.5 25.5V25.5C17.5 26.8807 16.3807 28 15 28V28C13.6193 28 12.5 26.8807 12.5 25.5V1" stroke="#504511" stroke-width="2" stroke-linecap="round"/>
</svg>
</div>
<div class="blinds">
<div class="blinds-top"></div>
<ul class="blinds-rows">
<li class="blinds-row"></li>
<li class="blinds-row"></li>
<li class="blinds-row"></li>
<li class="blinds-row"></li>
<li class="blinds-row"></li>
<li class="blinds-row"></li>
<li class="blinds-row"></li>
<li class="blinds-row"></li>
<li class="blinds-row"></li>
<li class="blinds-row"></li>
<li class="blinds-row"></li>
<li class="blinds-row"></li>
<li class="blinds-row"></li>
<li class="blinds-row"></li>
<li class="blinds-row"></li>
<li class="blinds-row"></li>
</ul>
</div>
<div class="code">
<svg width="280" height="205" viewBox="0 0 280 205" fill="none" xmlns="http://www.w3.org/2000/svg">
<line x1="2.5" y1="2.5" x2="47.5" y2="2.5" stroke="#E1CA72" stroke-width="5" stroke-linecap="round" stroke-linejoin="round"/>
<line x1="2.5" y1="22.5" x2="47.5" y2="22.5" stroke="#E1CA72" stroke-width="5" stroke-linecap="round" stroke-linejoin="round"/>
<line x1="27.5" y1="42.5" x2="102.5" y2="42.5" stroke="#9F8198" stroke-width="5" stroke-linecap="round" stroke-linejoin="round"/>
<line x1="27.5" y1="102.5" x2="142.5" y2="102.5" stroke="#9F8198" stroke-width="5" stroke-linecap="round" stroke-linejoin="round"/>
<line x1="27.5" y1="122.5" x2="92.5" y2="122.5" stroke="#9F8198" stroke-width="5" stroke-linecap="round" stroke-linejoin="round"/>
<line x1="27.5" y1="162.5" x2="122.5" y2="162.5" stroke="#9F8198" stroke-width="5" stroke-linecap="round" stroke-linejoin="round"/>
<line x1="27.5" y1="182.5" x2="122.5" y2="182.5" stroke="#9F8198" stroke-width="5" stroke-linecap="round" stroke-linejoin="round"/>
<line x1="27.5" y1="142.5" x2="172.5" y2="142.5" stroke="#9F8198" stroke-width="5" stroke-linecap="round" stroke-linejoin="round"/>
<line x1="2.5" y1="82.5" x2="47.5" y2="82.5" stroke="#E1CA72" stroke-width="5" stroke-linecap="round" stroke-linejoin="round"/>
<line x1="127.5" y1="122.5" x2="162.5" y2="122.5" stroke="#E1CA72" stroke-width="5" stroke-linecap="round" stroke-linejoin="round"/>
<line x1="138.5" y1="42.5" x2="173.5" y2="42.5" stroke="#DE7300" stroke-width="5" stroke-linecap="round" stroke-linejoin="round"/>
<line x1="177.5" y1="102.5" x2="232.5" y2="102.5" stroke="#7A99AD" stroke-width="5" stroke-linecap="round" stroke-linejoin="round"/>
<line x1="207.5" y1="142.5" x2="257.5" y2="142.5" stroke="#E1CA72" stroke-width="5" stroke-linecap="round" stroke-linejoin="round"/>
<line x1="157.5" y1="162.5" x2="207.5" y2="162.5" stroke="#E1CA72" stroke-width="5" stroke-linecap="round" stroke-linejoin="round"/>
<line x1="157.5" y1="182.5" x2="247.5" y2="182.5" stroke="#E1CA72" stroke-width="5" stroke-linecap="round" stroke-linejoin="round"/>
<line x1="2.5" y1="62.5" x2="17.5" y2="62.5" stroke="white" stroke-width="5" stroke-linecap="round" stroke-linejoin="round"/>
<line x1="2.5" y1="202.5" x2="17.5" y2="202.5" stroke="white" stroke-width="5" stroke-linecap="round" stroke-linejoin="round"/>
<line x1="62.5" y1="2.5" x2="67.5" y2="2.5" stroke="white" stroke-width="5" stroke-linecap="round" stroke-linejoin="round"/>
<line x1="117.5" y1="42.5" x2="122.5" y2="42.5" stroke="white" stroke-width="5" stroke-linecap="round" stroke-linejoin="round"/>
<line x1="188.5" y1="42.5" x2="193.5" y2="42.5" stroke="white" stroke-width="5" stroke-linecap="round" stroke-linejoin="round"/>
<line x1="157.5" y1="102.5" x2="162.5" y2="102.5" stroke="white" stroke-width="5" stroke-linecap="round" stroke-linejoin="round"/>
<line x1="247.5" y1="102.5" x2="252.5" y2="102.5" stroke="white" stroke-width="5" stroke-linecap="round" stroke-linejoin="round"/>
<line x1="107.5" y1="122.5" x2="112.5" y2="122.5" stroke="white" stroke-width="5" stroke-linecap="round" stroke-linejoin="round"/>
<line x1="177.5" y1="122.5" x2="182.5" y2="122.5" stroke="white" stroke-width="5" stroke-linecap="round" stroke-linejoin="round"/>
<line x1="137.5" y1="162.5" x2="142.5" y2="162.5" stroke="white" stroke-width="5" stroke-linecap="round" stroke-linejoin="round"/>
<line x1="222.5" y1="162.5" x2="227.5" y2="162.5" stroke="white" stroke-width="5" stroke-linecap="round" stroke-linejoin="round"/>
<line x1="137.5" y1="182.5" x2="142.5" y2="182.5" stroke="white" stroke-width="5" stroke-linecap="round" stroke-linejoin="round"/>
<line x1="262.5" y1="182.5" x2="267.5" y2="182.5" stroke="white" stroke-width="5" stroke-linecap="round" stroke-linejoin="round"/>
<line x1="187.5" y1="142.5" x2="192.5" y2="142.5" stroke="white" stroke-width="5" stroke-linecap="round" stroke-linejoin="round"/>
<line x1="272.5" y1="142.5" x2="277.5" y2="142.5" stroke="white" stroke-width="5" stroke-linecap="round" stroke-linejoin="round"/>
<line x1="62.5" y1="22.5" x2="77.5" y2="22.5" stroke="white" stroke-width="5" stroke-linecap="round" stroke-linejoin="round"/>
<line x1="62.5" y1="82.5" x2="77.5" y2="82.5" stroke="white" stroke-width="5" stroke-linecap="round" stroke-linejoin="round"/>
</svg>
</div>
<span class="toggle">
<input type="checkbox" name="item-details-private" id="item-details-private">
<label for="item-details-private"></label>
</span>
</div>
html, body {
height: 95%;
}
body {
background: #131417;
display: flex;
align-items: center;
justify-content: center;
transform: scale(0.75);
}
.illustration-pro {
display: grid;
grid-template-rows: 24px auto;
justify-items: center;
position: relative;
}
.illustration-pro .code {
background: #202125;
width: 388px;
height: 277px;
border-radius: 10px;
}
.illustration-pro .code svg {
margin: 25px;
}
.illustration-pro .light {
position: absolute;
z-index: 8;
right: 67px;
top: 24px;
}
.illustration-pro .light-blub {
position: relative;
z-index: 3;
}
.illustration-pro .light-shine {
position: absolute;
z-index: 2;
right: -51px;
top: 23px;
}
.illustration-pro .light-filament {
position: absolute;
top: 9px;
left: 50%;
z-index: 4;
margin-left: -10.25px;
}
.illustration-pro .toggle {
position: relative;
display: inline-block;
width: 80px;
height: 38px;
border-radius: 2em;
background: #F0F1F6;
vertical-align: middle;
margin: -12px 5px 0;
cursor: pointer;
}
.illustration-pro .toggle input {
opacity: 0;
width: 100% !important;
height: 100%;
position: absolute !important;
}
.illustration-pro .toggle label {
display: block !important;
width: 100% !important;
height: 100%;
border-radius: 2em;
transition: background 0.125s;
background: #47CF73;
}
.illustration-pro .toggle label::after {
position: absolute;
content: "";
top: -2px;
left: 0;
height: 42px;
width: 42px;
border-radius: inherit;
transition: all 0.2s;
transform: scale(1.1);
right: 1.4em;
background: linear-gradient(180deg, #FFFFFF 0%, #DDDFEA 100%);
box-shadow: 0px 6px 6px rgba(0, 0, 0, 0.25);
}
.illustration-pro .toggle input:checked + label {
background: #FF6468;
}
.illustration-pro .toggle input:checked + label::after {
right: 0;
left: 36px;
}
.illustration-pro .blinds {
display: grid;
justify-items: center;
position: relative;
height: 307px;
overflow: hidden;
}
.illustration-pro .blinds-top {
z-index: 10;
width: 419px;
height: 14px;
background: #4C4F5A;
border-radius: 5px;
position: relative;
}
.illustration-pro .blinds-top::before {
content: "";
position: absolute;
width: 6px;
height: 14px;
top: 0;
left: 0;
border-radius: 100%;
background: #202125;
}
.illustration-pro .blinds-rows {
z-index: 9;
position: relative;
margin: 6px 0 0;
padding: 0;
height: 300px;
}
.illustration-pro .blinds-rows::before, .illustration-pro .blinds-rows::after {
opacity: 0;
content: "";
position: absolute;
top: 0;
width: 2px;
height: 230px;
background: #36383F;
top: -5px;
}
.illustration-pro .blinds-rows::before {
left: 50px;
}
.illustration-pro .blinds-rows::after {
right: 50px;
}
.illustration-pro .blinds-row {
transition: 0.3s ease transform;
width: 414px;
height: 9px;
background: #36383F;
display: block;
margin-bottom: 6px;
}
.illustration-pro .blinds-row:last-child {
position: relative;
opacity: 1;
}
.illustration-pro .blinds-row:last-child::before {
content: "";
position: absolute;
top: 18px;
left: 50%;
margin-left: -10px;
width: 14px;
height: 14px;
border-radius: 100%;
border: 3px solid #4C4F5A;
}
.illustration-pro .blinds-row:last-child::after {
content: "";
position: absolute;
bottom: -10px;
left: 50%;
margin-left: -1px;
width: 2px;
height: 10px;
background: #4C4F5A;
}
.illustration-pro.public .blinds-rows {
transform: translateY(-240px);
transition: 1s ease transform;
}
.illustration-pro.public .blinds-rows::before, .illustration-pro.public .blinds-rows::after {
opacity: 0;
transition: 1s ease opacity;
}
.illustration-pro.public .blinds-row {
opacity: 0;
transition: 2s ease opacity;
}
.illustration-pro.public .blinds-row:last-child {
opacity: 1;
}
.illustration-pro.public .code svg {
opacity: 1;
transition: 1s ease opacity;
}
.illustration-pro.private .blinds-rows {
transform: translateY(0);
transition: 1s ease transform;
}
.illustration-pro.private .blinds-rows::before, .illustration-pro.private .blinds-rows::after {
opacity: 1;
}
.illustration-pro.private .blinds-row {
opacity: 1;
transition: 1s ease transform;
}
.illustration-pro.private .code svg {
opacity: 0.2;
transition: 1s ease opacity;
}
$('#item-details-private').click(function() {
$('.illustration-pro').toggleClass('public');
$('.illustration-pro').toggleClass('private');
});
Also see: Tab Triggers