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.
<div class="form-wrapper">
<div id="progress">
<div class="circle-1 circle active"></div>
<div class="circle-2 circle"></div>
<div class="circle-3 circle"></div>
</div>
<form id="mst-form" action="">
<fieldset class="field-1">
<label for="one" class="form-label anim-each">Field One</label>
<input type="text" id="one" class="el-margin anim-each">
<label for="two" class="form-label anim-each">Field Two</label>
<input type="text" id="two" class="el-margin anim-each">
<label for="three" class="form-label anim-each">Field Two</label>
<input type="text" id="three" class="el-margin anim-each" >
<div class="rt-btn-holder btn-fade">
<button class="ghost-btn weight-thin btn-font-size next-1">next</button>
</div>
</fieldset>
<fieldset class="field-2">
<label for="four" class="form-label anim-each">Field Four</label>
<input type="text" id="four" class="el-margin anim-each">
<label for="five" class="form-label anim-each">Field Five</label>
<input type="text" id="five" class="el-margin anim-each">
<label for="six" class="form-label anim-each">Field Six</label>
<input type="text" id="six" class="el-margin anim-each" >
<div class="lft-btn-holder btn-fade">
<button class="ghost-btn weight-thin btn-font-size prev-1">prev</button>
</div>
<div class="rt-btn-holder btn-fade">
<button class="ghost-btn weight-thin btn-font-size next-2">next</button>
</div>
</fieldset>
<fieldset class="field-3">
<label for="seven" class="form-label anim-each">Field Seven</label>
<input type="text" id="seven" class="el-margin anim-each">
<label for="eight" class="form-label anim-each">Field Eight</label>
<input type="text" id="eight" class="el-margin anim-each">
<label for="nine" class="form-label anim-each">Field Nine</label>
<input type="text" id="nine" class="el-margin anim-each" >
<div class="lft-btn-holder btn-fade">
<button class="ghost-btn weight-thin btn-font-size prev-2">prev</button>
</div>
<div class="rt-btn-holder btn-fade">
<input type="submit" name="submit" class="ghost-btn weight-thin btn-font-size submit">
</div>
</fieldset>
</form>
</div>
@import url('https://fonts.googleapis.com/css?family=Open+Sans:300,400,700');
html {
height: 100%;
padding: 0;
margin: 0;
}
body {
background-color: #324c5b;
color: #fff;
display: -webkit-box;
display: -ms-flexbox;
display: flex;
-webkit-box-orient: vertical;
-webkit-box-direction: normal;
-ms-flex-direction: column;
flex-direction: column;
justify-content: center;
font-weight: 100;
font-size: 1em;
font-family: 'Open Sans', sans-serif;
overflow: hidden;
overflow-y: scroll;
min-height: 100%;
}
.form-wrapper {
max-width: 1000px;
margin: 0 auto;
padding: 0 2em;
}
/*********************
Button Styles
*********************/
.ghost-btn {
background: transparent;
border: 2px solid white;
border-radius: 4px;
color: white;
padding: .2em 2em;
text-transform: uppercase;
font-family: 'Open Sans', sans-serif;
transition: .25s ease;
}
.ghost-btn:hover {
background-color: white;
color: #324c5b;
}
.rt-btn-holder {
float: right;
}
.lft-btn-holder {
float: left;
}
.opening-btn {
font-size: .8em;
}
.btn-font-size {
font-size: 2em;
}
/**************
Form
**************/
#progress {
counter-reset: circle;
text-align: center;
overflow: hidden;
display: -webkit-box;
display: -ms-flexbox;
display: flex;
-webkit-box-pack: center;
-ms-flex-pack: center;
justify-content: center;
margin-bottom: 2em
}
.circle {
background-color: gray;
border-radius: 50%;
color: #283d4a;
font-size: 1.5em;
font-weight: 500;
margin: 0 .8em;
position: relative;
height: 50px;
width: 50px;
}
.circle:before {
content: counter(circle);
counter-increment: circle;
position: absolute;
top: 10px;
left: 0;
right: 0
}
.circle.active {
background-color: white;
}
fieldset {
border: none;
max-width: 1200px;
}
label {
/* clear: both; */
/* display: block; */
}
input[type="text"] {
background: transparent;
border: 0;
border-bottom: 2px solid #aaaaaa;
color: #e5e5e5;
font-family: 'Open Sans', sans-serif;
font-size: 1.8em;
font-weight: 100;
outline: none;
padding: 0 0 .25em .15em;
width: 100%;
}
input[type="text"]:focus {
border: 0;
border-bottom: 2px solid white;
}
.el-margin {
margin: 0 0 1.8em ;
}
.form-label {
font-size: 1.9em;
margin-bottom: .25em;
}
.hidden-fields {
opacity: 0;
}
.hide-fields {
opacity: 0;
}
/****************
Fieldsets
****************/
fieldset {
min-height: 500px;
}
.field-2, .field-3 {
display: none;
}
(function(){
'use strict';
var field1 = ('.field-1'),
field2 = ('.field-2'),
field3 = ('.field-3'),
circle1 = ('.circle-1'),
circle2 = ('.circle-2'),
circle3 = ('.circle-3');
//var tween = new TimelineMax();
var tween = new TimelineLite();
//Screen One
function screenOne(){
var next = document.querySelector('.next-1');
next.addEventListener('click', function(e) {
e.preventDefault();
//circles rotate backwards and previous number is highlighted with .active class and removed from next circle (currCircle, nextCircle)
nextCircle(circle1, circle2);
//When NEXT button is clicked the next fieldset shows and the previous hides (prevField, nextField)
nextFieldSet(field1, field2);
});
}screenOne();
//Screen Two
function screenTwo(){
var next = document.querySelector('.next-2'),
prev = document.querySelector('.prev-1');
next.addEventListener('click', function(e) {
e.preventDefault();
//circles rotate backwards and previous number is highlighted with .active class and removed from next circle (currCircle, nextCircle)
nextCircle( circle2, circle3);
//When NEXT button is clicked the next fieldset shows and the previous hides (prevField, nextField)
nextFieldSet(field2, field3);
});
/**How could I or should I combine these into the same tween--this is exhibiting some strange behavior. I **assume this because each function`previousCircle` && `previouosFieldSet` have seperate tweens
**Also could I just reverse the above functions `nextCircle` && `nextFieldset` instead of creating the **below functions?
**Thanks to anyone for help on this!!!!:)
*/
prev.addEventListener('click', function(e) {
e.preventDefault();
//.active class and removed prom next circle (prevCircle, currCircle)
previousCircle(circle1, circle2);
//next fieldset shows and the previous hides (prevField, currField)
previousFieldSet(field1, field2);
});
}screenTwo();
//Screen Six
function screenThree(){
var prev = document.querySelector('.prev-2');
prev.addEventListener('click', function(e) {
e.preventDefault();
//.active class and removed prom next circle (prevCircle, currCircle)
previousCircle(circle2, circle3);
//Prev fieldset shows and the previous hides (prevField, currField)
previousFieldSet(field2, field3);
});
}screenThree();
//When NEXT button is clicked the next fieldset shows and the previous hides
function nextFieldSet(currField, nextField){
var each = ('.anim-each');
var btnFAde = ('.btn-fade');
//this seems off to me to have display: 'none' and opacity: 0 but it was the only waht to get a smooth fade
tween
.to(currField, .1, {opacity:0, display: 'none', y:-100})
.to(nextField, .1, {display: 'block', opacity: 1})
.staggerFrom(each, .25, {opacity: 0, y:100}, .1)
.from(btnFAde, .1, {opacity: 0}, '-=.5');
}
//When NEXT button is clicked the next fieldset shows and the previous hides
function previousFieldSet(prevField, currField){
var btnFAde = ('.btn-fade');
tween.to(currField, .25, {opacity:0, display: 'none', y: 0})
.to(prevField, .25, {display: 'block', opacity: 1, y:0})
.to(btnFAde, .1, {opacity: 1});
}
/*When PREV button is clicked circles in the progress section rotate backwards and **previous number is highlighted with .active class and removed prom next circle
*/
function previousCircle(prevCircle, currCircle) {
tween.to(prevCircle, .15, {rotationY: -360, className: '+=active'})
.to(currCircle, .15, {rotationY: -360, className: '-=active'});
}
/*When NEXT button is clicked circles in the progress section rotate forwards and the **next number is highlighted with .active class and removoed from previous circle
*/
function nextCircle(currCircle, nextCircle) {
tween
.to(currCircle, .15, {rotationY: 360, className: '-=active'})
.to(nextCircle, .15, {rotationY: 360, className: '+=active'});
}
}()); //wrapper
Also see: Tab Triggers