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.
<form class="container">
<h2 class="heading">Sign Up</h2>
<div class="steps-container">
<hr>
<hr class="active">
<div class="steps"><i class="fa-solid fa-user"></i></div>
<div class="steps"><i class="fa-solid fa-envelope"></i></div>
<div class="steps"><i class="fa-solid fa-key"></i></div>
<div class="steps"><i class="fa-solid fa-trophy"></i></div>
</div>
<div class="input-slide-contianer">
<scroller>
<div class="input-slide">
<h3>User Name</h3>
<p><i>Username is your online identity</i></p>
<ul class="rules">
<li>Your username should only contain letters, numbers, underscores or hyphens. </li><li>No spaces or special characters allowed.</li>
<li>Your username should not be offensive or contain profanity.</li>
</ul>
<input type="text" placeholder="Type your username Here" name="username" class="username">
<div class="full-name"><input type="text" placeholder="First Name" name="firstname">
<input type="text" name="lastname" class="lastname" placeholder="Last Name"></div>
<button class="button-nex" onclick="NextSlide(1)">Next</button>
</div>
<div class="input-slide user-detail">
<h3>Email</h3>
<p><i>Email is the gateway to your digital life</i></p>
<ul class="rules">
<li>Please enter valid email in the format "example@example.com".</li>
<li>we value your privacy and will never use your email for any unauthorized purposes.</li>
<li>Please don't use email that belong to someone else.</li>
<li>Please don't use email that includes personal information.</li>
</ul>
<input type="email" name="email" class="email" placeholder="Email">
<button class="button-nex" onclick="NextSlide(2)">Next</button>
</div>
<div class="input-slide password-slide">
<h3>Password</h3>
<p><i>Secure your account with a strong password</i></p>
<ul class="rules">
<li>Include a mix of uppercase and lowercase letters, numbers, and special characters.</li>
<li>Avoid using common or easily guessable passwords.</li>
<li>Do not use personal information.</li>
</ul>
<input type="password" name="password" class="password" placeholder="Password">
<input type="password" name="confirm-password" class="confirm-password" placeholder="Confirm Your Password">
<button class="button-nex" onclick="NextSlide(3)">Next</button>
</div>
<div class="input-slide finish-slide">
<h3>Congratulations!</h3>
<p><i>You have completed all the steps required for registration.</i></p>
<ul class="rules">
<li>Before submitting your information, please take a moment to ensure that all the details provided are correct. </li>
<li> We take the privacy and security of our users very seriously, and it is important that all the information provided is accurate and up-to-date.</li>
<li>Once you have confirmed that everything is in order, simply click the 'Submit' button.</li>
</ul>
<button type="submit" class="button-nex" disabled>Sumbit</button>
</div>
</scroller>
</div>
<button class="GoBack" onclick="GoBack()"><i class="fa-solid fa-arrow-left"></i></button>
</form>
@import url('https://fonts.googleapis.com/css2?family=Exo:wght@100;200;300;400;500;600;700;800;900&display=swap');
*{
padding: 0;
margin: 0;
box-sizing: border-box;
}
body{
height:100vh;
background-color: #343a40;
display: flex;
}
.container{
width:500px;
height:500px;
margin:auto;
border-radius: 5px;
border:1px solid #ced4da;
font-family: Exo;
color:white;
background-color: #212529;
display: flex;
flex-direction: column;
padding:10px;
position: relative;
overflow: hidden;
}
.heading{
padding:20px;
font-weight: 900;
text-align: center;
font-size: 2em;
}
.steps-container{
position: relative;
display: flex;
height: 50px;;
margin:10px;
width:calc(100% - 20px)
}
.steps-container>hr{
width:100%;
height:5px;
background-color: white;
border-radius: 20px;
margin-top:25px;
position: absolute;
z-index:0;
border:none;
}
.steps-container>.active{
background:#80ed99;
width:0%;
}
.steps-container>.steps{
width:45px;
height:45px;
border-radius: 50%;
background-color: #f8f9fa;
color:#212529;
font-size: 1.4em;
display: flex;
border:5px solid #212529;
margin:auto;
position: relative;
box-sizing: content-box;
z-index: 1;
overflow: hidden;
}
.steps-container>.steps::after{
content:'';
position: absolute;
width:0%;
height: 45px;
background-color: #80ed99;
border-radius: 50%;
z-index: 2;
}
.steps-container>.steps>i{
margin:auto;
z-index: 3;
}
.input-slide-contianer{
width: 100%;
flex:1;
display:flex;
overflow: hidden;
}
scroller{
width:fit-content;
display: flex;
margin-left:0px;
transition-duration: 0.5s;
}
.input-slide-contianer>scroller>.input-slide{
width:478px;
display: flex;
flex-direction: column;
flex-shrink: 0;
}
.input-slide>h3{
text-align: center;
}
.input-slide>.rules{
list-style-type: disc;
display: flex;
flex-direction: column;
margin:auto;
padding-left:20px;
}
.input-slide>.rules>li{
padding:5px 0;
}
.input-slide input{
width:calc(100% - 20px);
padding:10px;
background-color: #6c757d;
outline:none;
border-radius:10px;
border:none;
/* box-shadow:1px 1px 15px 0.5px rgba(0, 0, 0, 0.5); */
margin:auto 10px;
font-size: 1.01em;
color:white;
box-sizing: border-box;
transition-duration: 0.3s;
position: relative;
}
.input-slide input::placeholder{
color:white !important;
font-size: 1.01em;
}
.input-slide input:focus{
border: 1px solid lime;
}
.button-nex{
padding:8px 20px;
border-radius: 20px;
color:white;
font-weight: 800;
outline:none;
border:none;
margin:auto;
margin-right:10px;
font-family:Exo;
font-size: 1em;
cursor:pointer;
background-color: #52b788;
}
.button-nex:hover{
background-color: #40916c;
}
.full-name{
display: flex;
}
.user-detail>input{
align-items: start;
margin:10px;
}
.user-detail>button{
margin:10px;
margin-left:auto;
}
.user-detail>.email{
width:calc(100% - 20px)
}
.input-slide p{
font-size: 0.8em;
text-align: center;
}
.finish-slide{
line-height:1.4em
}
:root{
--BarStartWidth:0%;
--BarEndWidth:calc(var(--BarStartWidth) + 25%);
}
.animateStep{
width:var(--BarEndWidth);
background-color: black;
animation: ZerotoHeroWidth 0.5s ease;
}
.PassedStep::after{
width:100% !important;
transition: 1s;
}
.GoBack{
width:fit-content;
padding:0px 10px;
font-size: 1.5em;
font-weight: 900;
position: absolute;
border-radius: 5px;
background-color: transparent;
border:none;
color:white;
cursor:pointer;
left:-50px;
}
.GoBack:hover{
background-color: #40916c;
}
@keyframes ZerotoHeroWidth{
0%{
width:0%;
}
100%{
width:100%
}
}
@keyframes GoBackBtnVisible {
0%{
left:-50px;
}
100%{
left:10px;
}
}
@keyframes GoBackBtnInvisible {
0%{
left:10px;
}
100%{
left:-50px;
}
}
var GlobalSlideNo;
function NextSlide(SlideNo){
GlobalSlideNo=SlideNo
event.preventDefault()
if(SlideNo==1){
document.querySelector(".GoBack").style.animation="GoBackBtnVisible 0.25s ease"
document.querySelector(".GoBack").onanimationend=function(){
this.style.animation=""
this.style.left="10px"
}
}
console.log(parseInt(window.getComputedStyle(document.querySelector("scroller")).getPropertyValue("margin-left"))-478);
document.querySelector("scroller").style.marginLeft=parseInt(window.getComputedStyle(document.querySelector("scroller")).getPropertyValue("margin-left"))-478+"px";
MoveIndicationBar(SlideNo)
}
IndicatorObj={
startVal:0,
EndVal:25,
currentWidth:0
}
function MoveIndicationBar(i){
var step=document.querySelectorAll(".steps")[i-1]
IndicatorObj.StepNo=i
console.log(step)
IndicatorObj.EndVal=i*25
ZerotoHeroWidth()
}
function ZerotoHeroWidth(){
var bar=document.querySelector(".active")
var step=document.querySelectorAll(".steps")[IndicatorObj.StepNo-1]
barStyle=parseInt(window.getComputedStyle(bar).width)
if(IndicatorObj.currentWidth>IndicatorObj.EndVal/2){
step.classList.add("PassedStep")
}
if(IndicatorObj.currentWidth<IndicatorObj.EndVal){
IndicatorObj.currentWidth+=1
bar.style.width=IndicatorObj.currentWidth+"%"
window.requestAnimationFrame(ZerotoHeroWidth)
}
}
function GoBack(){
event.preventDefault()
console.log(GlobalSlideNo)
if(GlobalSlideNo<2){
document.querySelector(".GoBack").style.animation="GoBackBtnInvisible 0.25s ease"
document.querySelector(".GoBack").onanimationend=function(){
this.style.animation=""
this.style.left="-50px"
}
}
GlobalSlideNo-=1
console.log(parseInt(window.getComputedStyle(document.querySelector("scroller")).getPropertyValue("margin-left"))+478);
document.querySelector("scroller").style.marginLeft=parseInt(window.getComputedStyle(document.querySelector("scroller")).getPropertyValue("margin-left"))+478+"px";
document.querySelector(".GoBack").onclick=function(){
event.preventDefault()
}
setTimeout(function(){
document.querySelector(".GoBack").onclick=GoBack
},500)
MoveIndicationBarMinus(GlobalSlideNo)
}
IndicatorObj={
startVal:25,
EndVal:0,
currentWidth:0
}
function MoveIndicationBarMinus(i){
IndicatorObj.StepNo=i
IndicatorObj.EndVal=i*25
HerotoZeroWidth()
console.log(IndicatorObj)
}
function HerotoZeroWidth(){
var bar=document.querySelector(".active")
var step=document.querySelectorAll(".steps")[IndicatorObj.StepNo-1]
barStyle=parseInt(window.getComputedStyle(bar).width)
if(IndicatorObj.currentWidth>IndicatorObj.EndVal){
IndicatorObj.currentWidth-=1
bar.style.width=IndicatorObj.currentWidth+"%"
window.requestAnimationFrame(HerotoZeroWidth)
}
}
Also see: Tab Triggers