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.
<header></header>
<main>
<div class="navContainer">
<a href="#" class="navItem">
<div class="innerCircle">
<i class="fa fa-check icon icon-check"></i>
<i class="fa fa-arrow-right icon icon-right"></i>
</div>
<div class="line"></div>
<div class="navItem-label">Step 1</div>
</a>
<a href="#" class="navItem">
<div class="innerCircle">
<i class="fa fa-check icon icon-check"></i>
<i class="fa fa-arrow-right icon icon-right"></i>
</div>
<div class="line"></div>
<div class="navItem-label">Step 2</div>
</a>
<a href="#" class="navItem">
<div class="innerCircle">
<i class="fa fa-check icon icon-check"></i>
<i class="fa fa-arrow-right icon icon-right"></i>
</div>
<div class="line"></div>
<div class="navItem-label">Step 3</div>
</a>
<a href="#" class="navItem">
<div class="innerCircle">
<i class="fa fa-check icon icon-check"></i>
<i class="fa fa-arrow-right icon icon-right"></i>
</div>
<div class="line"></div>
<div class="navItem-label">Step 4</div>
</a>
<a href="#" class="navItem">
<div class="innerCircle">
<i class="fa fa-check icon icon-check"></i>
<i class="fa fa-arrow-right icon icon-right"></i>
</div>
<div class="line"></div>
<div class="navItem-label">Step 5</div>
</a>
<a href="#" class="navItem">
<div class="innerCircle">
<i class="fa fa-check icon icon-check"></i>
<i class="fa fa-arrow-right icon icon-right"></i>
</div>
<div class="navItem-label">Step 6</div>
</a>
</div>
<div class="contentContainer">
<div id="stepOne" class="content" data-content="1">
<p>Sed ut perspiciatis unde omnis iste natus error sit voluptatem accusantium doloremque laudantium, totam rem aperiam, eaque ipsa quae ab illo inventore veritatis et quasi architecto beatae vitae dicta sunt explicabo.</p>
<p>Nemo enim ipsam voluptatem quia voluptas sit aspernatur aut odit aut fugit, sed quia consequuntur magni dolores eos qui ratione voluptatem sequi nesciunt. Neque porro quisquam est, qui dolorem ipsum quia dolor sit amet, consectetur, adipisci velit, sed quia non numquam eius modi tempora incidunt ut labore et dolore magnam aliquam quaerat voluptatem.</p>
</div>
<div id="stepTwo" class="content" data-content="2">
<p>Lorem ipsum dolor sit amet, consectetur adipiscing elit, sed do eiusmod tempor incididunt ut labore et dolore magna aliqua. Ut enim ad minim veniam, quis nostrud exercitation ullamco laboris nisi ut aliquip ex ea commodo consequat. Duis aute irure dolor in reprehenderit in voluptate velit esse cillum dolore eu fugiat nulla pariatur. Excepteur sint occaecat cupidatat non proident, sunt in culpa qui officia deserunt mollit anim id est laborum</p>
</div>
<div id="stepThree" class="content" data-content="3">
<p>At vero eos et accusamus et iusto odio dignissimos ducimus qui blanditiis praesentium voluptatum deleniti atque corrupti quos dolores et quas molestias excepturi sint occaecati cupiditate non provident, similique sunt in culpa qui officia deserunt mollitia animi, id est laborum et dolorum fuga. Et harum quidem rerum facilis est et expedita distinctio. Nam libero tempore, cum soluta nobis est eligendi optio cumque nihil impedit quo minus id quod maxime placeat facere possimus, omnis voluptas assumenda est, omnis dolor repellendus.</p>
<p>Temporibus autem quibusdam et aut officiis debitis aut rerum necessitatibus saepe eveniet ut et voluptates repudiandae sint et molestiae non recusandae. Itaque earum rerum hic tenetur a sapiente delectus, ut aut reiciendis voluptatibus maiores alias consequatur aut perferendis doloribus asperiores repellat.</p>
</div>
<div id="stepFour" class="content" data-content="5">
<p> Morbi dapibus, metus eu pellentesque vulputate, justo mi dapibus nibh, at dapibus tortor sem in urna. Pellentesque vel tristique nunc. Nullam et neque id enim rhoncus accumsan. Sed eu tempus turpis. Morbi in dui dui. In aliquet, lectus eget pellentesque suscipit, leo mauris rhoncus purus, ut vestibulum enim purus vel lectus.</p>
</div>
<div id="stepFive" class="content" data-content="5">
<p>In aliquet, lectus eget pellentesque suscipit, leo mauris rhoncus purus, ut vestibulum enim purus vel lectus. Morbi dapibus, metus eu pellentesque vulputate, justo mi dapibus nibh, at dapibus tortor sem in urna. Pellentesque vel tristique nunc. Cras eget arcu vel arcu sagittis imperdiet. Vivamus rutrum blandit pharetra. Maecenas fermentum purus in nibh auctor, at pellentesque elit congue. Nullam et neque id enim rhoncus accumsan. Sed eu tempus turpis. Morbi in dui dui. </p>
</div>
<div id="stepSix" class="content" data-content="6">
<p>Mauris tortor dolor, ullamcorper eu volutpat eget, semper at massa. Morbi pharetra accumsan faucibus. Proin at tincidunt lectus. Donec sit amet leo nec justo tincidunt cursus. Suspendisse ac turpis vitae elit iaculis molestie a id lacus. Donec et ultrices dolor. Sed tristique sem ut orci tincidunt hendrerit.</p>
<p>Vivamus justo eros, ultricies eu molestie id, ornare at ante. Etiam porta posuere nibh a suscipit. Maecenas sodales tempus gravida. Interdum et malesuada fames ac ante ipsum primis in faucibus. In ornare dolor nisl, non commodo est sagittis facilisis. Nam lacinia feugiat velit, non tincidunt eros auctor sed. </p>
</div>
</div>
<div class="control">
<button id="prev" class="prev"><i class="fa fa-angle-left"></i>Previous</button>
<button id="next" class="next">Next<i class="fa fa-angle-right"></i></button>
</div>
</main>
<footer></footer>
* {
box-sizing: border-box;
}
body {
display: grid;
grid-template-areas: "header"
"main"
"footer";
grid-template-columns: 1fr;
grid-template-rows: 40px 1fr 40px;
height: 100vh;
max-height: 100%;
overflow: none;
padding: 25px;
background-color: #fbfdfd;
color: #6e6e6e;
font-family: 'Verdana', sans-serif;
}
p {
margin-bottom: 15px;
line-height: 1.5;
}
header {
grid-area: header;
}
main {
// background-color: #e3e3e3;
grid-area: main;
display: grid;
grid-template-areas: "nav"
"content"
"control";
grid-template-columns: 1fr;
grid-template-rows: 1fr 3fr 1fr;
padding: 20px;
}
.navContainer {
display: flex;
justify-content: center;
margin-bottom: 45px;
grid-area: "nav";
}
.navItem {
display: inline-block;
position: relative;
min-width: 100px;
margin-right: 10px;
text-decoration: none;
color: #ddd;
max-height: 95px;
&:last-child {
margin-right: 0;
width: auto;
min-width: 0;
}
&.active {
.innerCircle {
border-color: #abdf75;
}
.icon-right {
color: #abdf75;
visibility: visible;
}
.navItem-label {
color: #abdf75;
}
}
&.visited {
.innerCircle {
border-color: #c75000;
}
.icon-check {
color: #c75000;
visibility: visible;
}
.icon-right {
visibility: hidden;
}
.navItem-label {
color: #c75000;
}
.line {
opacity: 1;
background-color: #c75000;
}
}
}
.innerCircle {
display: inline-block;
border: 6px solid #dedede;
border-radius: 50%;
padding: 20px;
position: relative;
transition: all 0.3s ease-in;
&.active {
border-color: #abdf75;
}
}
.icon {
color: #dedede;
position: absolute;
top: 50%;
left: 50%;
transform: translate(-50%, -50%);
visibility: hidden;
&-right {
color: #abdf75;
}
}
.line {
display: inline-block;
width: 40px;
height: 8px;
background-color: #dedede;
border-radius: 30px;
position: absolute;
top: 50%;
right: 0;
transform: translateY(-50% - 220px);
opacity: 0;
transition: opacity .3s ease-in;
}
.navItem-label {
margin-top: 15px;
transition: all .3s ease;
}
.contentContainer {
padding: 30px 0;
grid-area: "content";
position: relative;
overflow: hidden;
margin-bottom: 30px
}
.content {
width: 100%;
max-width: 640px;
margin: 0 auto;
text-align: justify;
opacity: 0;
transition: all .3s ease;
position: absolute;
left: 50%;
transform: translateX(-50%);
top: 20px;
height: 100%;
overflowY: auto;
&.active {
opacity: 1;
}
}
.control {
text-align: center;
grid-area: "control";
}
.next,
.prev {
font-family: 'Verdana', sans-serif;
background: none;
display: inline-block;
width: 140px;
margin: 0 15px;
text-align: center;
padding: 15px;
border: 2px solid;
border-radius: 30px;
transition: all .3s ease;
font-weight: bold;
}
.next {
color: #abdf75;
border-color: #abdf75;
&:hover {
background-color: #abdf75;
color: #fff;
}
i {
margin-left: 10px;
}
}
.prev {
color: #c75000;
border-color: #c75000;
&:hover {
background-color: #c75000;
color: #fff;
}
i {
margin-right: 10px;
}
}
footer {
grid-area: footer
}
(function navigation() {
var navs = document.getElementsByClassName('navItem'),
contents = document.getElementsByClassName('content'),
next = document.getElementById('next'),
prev = document.getElementById('prev'),
counter = 0;
navs[counter].classList.add('active');
contents[counter].classList.add('active');
next.addEventListener('click', goToNext);
prev.addEventListener('click', goToPrev);
function goToNext() {
if(counter < (navs.length - 1)) {
navs[counter].classList.remove('active');
contents[counter].style.opacity = 0;
counter += 1;
var nav = navs[counter];
var content = contents[counter];
nav.classList.add('active');
nav.previousElementSibling.classList.remove('active');
nav.previousElementSibling.classList.add('visited');
content.style.opacity = 1 ;
}
}
function goToPrev() {
if(counter > 0) {
var that = navs[counter];
var thatContent = contents[counter];
counter -= 1;
that.classList.remove('active');
that.previousElementSibling.classList.remove('visited');
that.previousElementSibling.classList.add('active');
thatContent.style.opacity = 0;
contents[counter].style.opacity = 1;
}
}
})();
Also see: Tab Triggers