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.
<link href='https://fonts.googleapis.com/css?family=Lobster' rel='stylesheet' type='text/css'>
<link href='https://fonts.googleapis.com/css?family=Yanone+Kaffeesatz:200' rel='stylesheet' type='text/css'>
<link href='https://fonts.googleapis.com/css?family=Alegreya+Sans+SC:800' rel='stylesheet' type='text/css'>
<div class="main-content">
<div class="mask">
<svg width="100%" height="100%" viewBox="0 0 400 400" enable-background="new 0 0 400 400" xml:space="preserve">
<defs>
<filter id="shadow1">
<feGaussianBlur stdDeviation="2" in="SourceAlpha" />
<feOffset dx="2" dy="1" result="offsetblur" mode="multiply"/>
</filter>
<filter id="shadow2">
<feGaussianBlur stdDeviation="2" in="SourceAlpha" />
<feOffset dx="-2" dy="-1" result="offsetblur" mode="multiply"/>
</filter>
</defs>
<g><path d="M-0.511,0v400h401V0H-0.511z M360.729,292.798l-161.24,93.093L38.25,292.798V106.614l161.239-93.092l161.24,93.092V292.798z" filter="url(#shadow1)"/></g>
<g><path d="M-0.511,0v400h401V0H-0.511z M360.729,292.798l-161.24,93.093L38.25,292.798V106.614l161.239-93.092l161.24,93.092V292.798z" filter="url(#shadow2)"/></g>
<g id="mask">
<path d="M-0.511,0v400h401V0H-0.511z M360.729,292.798l-161.24,93.093L38.25,292.798V106.614l161.239-93.092l161.24,93.092V292.798z"/>
</g>
<g class="border1">
<polygon points="199.49,14.678 156.518,39.627 149.93,28.684 199.587,0.015 322.441,70.946 315.668,81.778" />
<polygon points="156.867,38.268 151.312,29.041 199.587,1.17 321.044,71.294 315.332,80.429 199.489,13.522" />
</g>
<g class="border2">
<polygon points="359.598,248.5 359.598,107.141 313.935,80.777 320.708,69.945 372.365,99.769 372.365,248.5"/>
<polygon points="315.332,80.429 360.598,106.564 360.598,247.5 371.365,247.5 371.365,100.346 321.044,71.294"/>
</g>
<g class="border3">
<polygon points="238.784,361.657 359.598,291.906 359.598,246.5 372.365,246.5 372.365,299.277 243.778,373.516"/>
<polygon points="360.598,247.5 360.598,292.483 240.048,362.082 244.26,372.084 371.365,298.7 371.365,247.5"/>
</g>
<g class="border4">
<polygon points="73.809,326.412 81.666,316.204 199.486,384.732 240.526,360.641 245.523,372.509 199.587,399.03"/>
<polygon points="240.048,362.082 199.489,385.89 81.922,317.51 75.297,326.117 199.587,397.876 244.26,372.084"/>
</g>
<g class="border5">
<polygon points="26.809,299.277 26.809,158.045 39.576,157.452 39.576,291.906 83.411,317.215 75.556,327.421"/>
<polygon points="81.922,317.51 38.576,292.483 38.576,158.5 27.809,159 27.809,298.7 75.297,326.117"/>
</g>
<g class="border6">
<polygon points="26.809,99.769 151.662,27.684 158.249,38.625 39.253,107.19 39.582,159.454 26.809,160.047"/>
<polygon points="38.576,158.5 38.25,106.614 156.867,38.268 151.312,29.041 27.809,100.346 27.809,159"/>
</g>
</svg>
</div>
<div class="shutter-area">
<div class="text">
<h3>Dan's</h3>
<h2>SHUTTER</h2>
<h1>TEST</h1>
</div>
<div class="shutter no-1">
<svg version="1.1" id="Layer_1" xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink" x="0px" y="0px" width="200%" height="200%" viewBox="-6.274 0 190.726 186.986" enable-background="new -6.274 0 190.726 186.986" xml:space="preserve">
<path d="M184.451,104.943V0H8.157C-7.389,28.493-6.256,61.293-6.256,96.208c0,32.716,14.036,63.578,27.806,90.778
C55.825,132.013,115.929,105.426,184.451,104.943z"/>
</svg>
</div>
<div class="shutter no-2">
<svg version="1.1" id="Layer_1" xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink" x="0px" y="0px" width="200%" height="200%" viewBox="-6.274 0 190.726 186.986" enable-background="new -6.274 0 190.726 186.986" xml:space="preserve">
<path d="M184.451,104.943V0H8.157C-7.389,28.493-6.256,61.293-6.256,96.208c0,32.716,14.036,63.578,27.806,90.778
C55.825,132.013,115.929,105.426,184.451,104.943z"/>
</svg></div>
<div class="shutter no-3">
<svg version="1.1" id="Layer_1" xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink" x="0px" y="0px" width="200%" height="200%" viewBox="-6.274 0 190.726 186.986" enable-background="new -6.274 0 190.726 186.986" xml:space="preserve">
<path d="M184.451,104.943V0H8.157C-7.389,28.493-6.256,61.293-6.256,96.208c0,32.716,14.036,63.578,27.806,90.778
C55.825,132.013,115.929,105.426,184.451,104.943z"/>
</svg></div>
<div class="shutter no-4">
<svg version="1.1" id="Layer_1" xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink" x="0px" y="0px" width="200%" height="200%" viewBox="-6.274 0 190.726 186.986" enable-background="new -6.274 0 190.726 186.986" xml:space="preserve">
<path d="M184.451,104.943V0H8.157C-7.389,28.493-6.256,61.293-6.256,96.208c0,32.716,14.036,63.578,27.806,90.778
C55.825,132.013,115.929,105.426,184.451,104.943z"/>
</svg></div>
<div class="shutter no-5">
<svg version="1.1" id="Layer_1" xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink" x="0px" y="0px" width="200%" height="200%" viewBox="-6.274 0 190.726 186.986" enable-background="new -6.274 0 190.726 186.986" xml:space="preserve">
<path d="M184.451,104.943V0H8.157C-7.389,28.493-6.256,61.293-6.256,96.208c0,32.716,14.036,63.578,27.806,90.778
C55.825,132.013,115.929,105.426,184.451,104.943z"/>
</svg></div>
<div class="shutter no-6">
<svg version="1.1" id="Layer_1" xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink" x="0px" y="0px" width="200%" height="200%" viewBox="-6.274 0 190.726 186.986" enable-background="new -6.274 0 190.726 186.986" xml:space="preserve">
<path d="M184.451,104.943V0H8.157C-7.389,28.493-6.256,61.293-6.256,96.208c0,32.716,14.036,63.578,27.806,90.778
C55.825,132.013,115.929,105.426,184.451,104.943z"/>
</svg></div>
</div><!--shutter-area-->
</div><!--main-content-->
@charset "UTF-8";
/* CSS Document */
body {
background: #2a282a;
color: white;
}
/*TYPE*/
h1, h2, h3, h4, h5, h6, p {
text-align: center;
text-shadow: 3px 3px 5px #000000;
}
h1 {
font: 140px/140px 'Yanone Kaffeesatz', sans-serif;
margin-top: -13px;
}
h2 {
font: 50px/50px 'Alegreya Sans SC', sans-serif;
margin-bottom: -10px;
}
h3 {
font: 30px/40px 'Lobster', cursive;
}
/*MAIN*/
.main-content { margin: 30px auto 0;
width: 400px;
position: relative;
}
.mask {
background-size:100% 100%;
width: 400px;
height: 400px;
position: absolute;
top: 0;
left: 0;
z-index: 10;
overflow: hidden;
}
#mask {
fill:#2a282a;
}
/*SHUTTER*/
.shutter-area {
width: 400px;
height: 400px;
overflow: hidden;
position: absolute;
background: #2b4654;
background: -moz-radial-gradient(center, ellipse cover, #2b4654 0%, #2a282a 46%, #2a282a 46%);
background: -webkit-gradient(radial, center center, 0px, center center, 100%, color-stop(0%,#2b4654), color-stop(46%,#2a282a), color-stop(46%,#2a282a));
background: -webkit-radial-gradient(center, ellipse cover, #2b4654 0%,#2a282a 46%,#2a282a 46%);
background: -o-radial-gradient(center, ellipse cover, #2b4654 0%,#2a282a 46%,#2a282a 46%);
background: -ms-radial-gradient(center, ellipse cover, #2b4654 0%,#2a282a 46%,#2a282a 46%);
background: radial-gradient(ellipse at center, #2b4654 0%,#2a282a 46%,#2a282a 46%);
filter: progid:DXImageTransform.Microsoft.gradient( startColorstr='#2b4654', endColorstr='#2a282a',GradientType=1 );
}
.shutter {
width: 184px;
height: 187px;
background-size:100% 100%;
position: absolute;
z-index: 0;
}
.no-1 {
top: -165px;
left: 147px;
z-index: 1;
}
.no-2 {
top: 211px;
left: 351px;
z-index: 1;
}
.no-3 {
top: 575px;
left: 130px;
z-index: 1;
}
.no-4 {
top: 566px;
left: -297px;
z-index: 1;
}
.no-5 {
top: 191px;
left: -503px;
z-index: 2;
}
.no-6 {
top: -175px;
left: -281px;
z-index: 1;
}
.no-1, .border1 {
fill: #97d17a;
}
.no-2, .border2 {
fill:#f6c45b;
}
.no-3, .border3 {
fill:#4aabd5;
}
.no-4, .border4 {
fill:#aaced0;
}
.no-5, .border5 {
fill:#de6d52;
}
.no-6, .border6 {
fill:#f5e448;
}
/*TEXT*/
.text {
margin-top: 90px;
}
// JavaScript Document
var shutterAll = document.getElementsByClassName('shutter');
var shutter01 = document.getElementsByClassName('no-1');
var shutter02 = document.getElementsByClassName('no-2');
var shutter03 = document.getElementsByClassName('no-3');
var shutter04 = document.getElementsByClassName('no-4');
var shutter05 = document.getElementsByClassName('no-5');
var shutter06 = document.getElementsByClassName('no-6');
//Resets
TweenLite.to(shutter01, 0, {transformOrigin:"150% 0%"});
TweenLite.to(shutter02, 0, {transformOrigin:"150% 0%"});
TweenLite.to(shutter03, 0, {transformOrigin:"150% 0%"});
TweenLite.to(shutter04, 0, {transformOrigin:"150% 0%"});
TweenLite.to(shutter05, 0, {transformOrigin:"150% 0%"});
TweenLite.to(shutter06, 0, {transformOrigin:"150% 0%"});
TweenLite.to(shutter02, 0, {rotationZ: 60});
TweenLite.to(shutter03, 0, {rotationZ: 120});
TweenLite.to(shutter04, 0, {rotationZ: 180});
TweenLite.to(shutter05, 0, {rotationZ: 240});
TweenLite.to(shutter06, 0, {rotationZ: 300});
//Timeline
var masterTimeline = new TimelineMax({repeat:-1, yoyo:true, repeatDelay:2});
var shutterAni = new TimelineMax({});
shutterAni
//Fully open
.to(shutter01, 0.5, {rotationZ: "+=27"}, "open")
.to(shutter02, 0.5, {rotationZ: "+=27"}, "open")
.to(shutter03, 0.5, {rotationZ: "+=27"}, "open")
.to(shutter04, 0.5, {rotationZ: "+=27"}, "open")
.to(shutter05, 0.5, {rotationZ: "+=27"}, "open")
.to(shutter06, 0.5, {rotationZ: "+=27"}, "open")
//Closed
.to(shutter01, 0.5, {rotationZ: "-=27"}, "close+=2")
.to(shutter02, 0.5, {rotationZ: "-=27"}, "close+=2")
.to(shutter03, 0.5, {rotationZ: "-=27"}, "close+=2")
.to(shutter04, 0.5, {rotationZ: "-=27"}, "close+=2")
.to(shutter05, 0.5, {rotationZ: "-=27"}, "close+=2")
.to(shutter06, 0.5, {rotationZ: "-=27"}, "close+=2")
//half
.to(shutter01, 0.5, {rotationZ: "+=12"}, "half")
.to(shutter02, 0.5, {rotationZ: "+=12"}, "half")
.to(shutter03, 0.5, {rotationZ: "+=12"}, "half")
.to(shutter04, 0.5, {rotationZ: "+=12"}, "half")
.to(shutter05, 0.5, {rotationZ: "+=12"}, "half")
.to(shutter06, 0.5, {rotationZ: "+=12"}, "half")
//Closed
.to(shutter01, 0.5, {rotationZ: "-=12"}, "close2")
.to(shutter02, 0.5, {rotationZ: "-=12"}, "close2")
.to(shutter03, 0.5, {rotationZ: "-=12"}, "close2")
.to(shutter04, 0.5, {rotationZ: "-=12"}, "close2")
.to(shutter05, 0.5, {rotationZ: "-=12"}, "close2")
.to(shutter06, 0.5, {rotationZ: "-=12"}, "close2")
//Fully open
.to(shutter01, 0.5, {rotationZ: "+=27"}, "open2")
.to(shutter02, 0.5, {rotationZ: "+=27"}, "open2")
.to(shutter03, 0.5, {rotationZ: "+=27"}, "open2")
.to(shutter04, 0.5, {rotationZ: "+=27"}, "open2")
.to(shutter05, 0.5, {rotationZ: "+=27"}, "open2")
.to(shutter06, 0.5, {rotationZ: "+=27"}, "open2")
;
masterTimeline.add(shutterAni)
Also see: Tab Triggers