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.
<!--
// projects
///////////////////////////////////-->
<div class="page__style projects">
<div class="page__description">
<div id="projects">
<h1>Projects</h1>
<button class="btn_nav projects_link">Projects</button>
<button class="btn_nav skills_link">Skills</button>
<button class="btn_nav home_link">Home</button>
<button class="btn_nav about_link">About</button>
<button class="btn_nav contact_link">Contact</button>
<p>Thanks <a href="https://codyhouse.co/gem/animated-page-transition/" target="_blank">codyhouse.co</a></p>
</div>
</div>
</div>
<!--
// skills
///////////////////////////////////-->
<div class="page__style skills">
<div class="page__description">
<div id="skills">
<h1>Skills</h1>
<button class="btn_nav projects_link">Projects</button>
<button class="btn_nav skills_link">Skills</button>
<button class="btn_nav home_link">Home</button>
<button class="btn_nav about_link">About</button>
<button class="btn_nav contact_link">Contact</button>
<p>Thanks <a href="https://codyhouse.co/gem/animated-page-transition/" target="_blank">codyhouse.co</a></p>
</div>
</div>
</div>
<!--
// about
///////////////////////////////////-->
<div class="page__style about">
<div class="page__description">
<div id="about">
<h1>About</h1>
<button class="btn_nav projects_link">Projects</button>
<button class="btn_nav skills_link">Skills</button>
<button class="btn_nav home_link">Home</button>
<button class="btn_nav about_link">About</button>
<button class="btn_nav contact_link">Contact</button>
<p>Thanks <a href="https://codyhouse.co/gem/animated-page-transition/" target="_blank">codyhouse.co</a></p>
</div>
</div>
</div>
<!--
// contact
///////////////////////////////////-->
<div class="page__style contact">
<div class="page__description">
<div id="contact">
<h1>Contact</h1>
<button class="btn_nav projects_link">Projects</button>
<button class="btn_nav skills_link">Skills</button>
<button class="btn_nav home_link">Home</button>
<button class="btn_nav about_link">About</button>
<button class="btn_nav contact_link">Contact</button>
<p>Thanks <a href="https://codyhouse.co/gem/animated-page-transition/" target="_blank">codyhouse.co</a></p>
</div>
</div>
</div>
<!--
// home
///////////////////////////////////-->
<div class="page__style home">
<div class="page__description">
<div id="home">
<div class="box"></div>
<h1>Home</h1>
<button class="btn_nav projects_link">Projects</button>
<button class="btn_nav skills_link">Skills</button>
<button class="btn_nav home_link">Home</button>
<button class="btn_nav about_link">About</button>
<button class="btn_nav contact_link">Contact</button>
<p>Thanks <a href="https://codyhouse.co/gem/animated-page-transition/" target="_blank">codyhouse.co</a></p>
</div>
</div>
</div>
// reset
*, :before, :after
box-sizing border-box
padding 0
margin 0
// styles
.hide
display none
.page__style
background #6D326D
font-family OpenSans-Regular, sans-serif
position fixed
top 0
right 0
bottom 0
left 0
height 100%
width 100%
margin auto auto
overflow hidden
.page__description
color #ffffff
font-weight 300
text-align center
h1
font-weight 300
margin-top 200px
margin-bottom 30px
.btn_nav
background #002A32
border-radius 30px
border none
color #fff
cursor pointer
font-family inherit
font-size 15px
font-weight bold
text-transform uppercase
letter-spacing 1px
margin-bottom 20px
padding 17px 30px
width 146px
&:focus,
&:active
outline none
a
text-decoration none
color #fff
&:hover
text-decoration underline
// Animation class
.animate_content
animation animate 3s ease
@keyframes animate
10%
transform scale(1, 0.002)
35%
transform scale(0.2, 0.002)
opacity 1
50%
transform scale(0.2, 0.002)
opacity 0
85%
transform scale(1, 0.002)
opacity 1
100%
transform scale(1, 1)
.fadeIn
z-index 10
/* home
-----------------------------------*/
.home
background #5DA9E9
/* Projects
-----------------------------------*/
.projects
background #BD5DE9
/* Skills
-----------------------------------*/
.skills
background #5DE974
/* About
-----------------------------------*/
.about
background #FB9B33
/* Contact
-----------------------------------*/
.contact
background #C9CDC0
/*****************************************************************
~ Mobile media-queries (max-width: 767px)
******************************************************************/
@media only screen and (max-width: 767px)
.page__description
h1
margin-top 100px
$('.btn_nav').click(function() {
// animate content
$('.page__style').addClass('animate_content');
$('.page__description').fadeOut(100).delay(2800).fadeIn();
setTimeout(function() {
$('.page__style').removeClass('animate_content');
}, 3200);
//remove fadeIn class after 1500ms
setTimeout(function() {
$('.page__style').removeClass('fadeIn');
}, 1500);
});
// on click show page after 1500ms
$('.home_link').click(function() {
setTimeout(function() {
$('.home').addClass('fadeIn');
}, 1500);
});
$('.projects_link').click(function() {
setTimeout(function() {
$('.projects').addClass('fadeIn');
}, 1500);
});
$('.skills_link').click(function() {
setTimeout(function() {
$('.skills').addClass('fadeIn');
}, 1500);
});
$('.about_link').click(function() {
setTimeout(function() {
$('.about').addClass('fadeIn');
}, 1500);
});
$('.contact_link').click(function() {
setTimeout(function() {
$('.contact').addClass('fadeIn');
}, 1500);
});
Also see: Tab Triggers