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.
<!--For our animations to look good, the animated elements need to be able to be scrolled to. For this example I've added dummy content to the top -->
<div class="main-container">
<div class="container">
<h1>Multi-step animation</h1>
<p>This animation will focus on fade in and up an element when it comes into the focus of the viewer. </p>
</div>
<div class="container">
<h2>Gallery Images</h2>
<p>Here we keep some of our latest images and designs. </p>
</div>
<div class="container cf">
<!-- Staff 1 -->
<div class="animation-element multi-step-left cf">
<div class="gallery">
<h3 class="title">Johnthon Smith</h3>
<h4 class="subtitle">Senior Enginer</h4>
<div class="image" style="background-image: url(https://drive.google.com/uc?export=download&id=0B7UPM0QugWUjVTdZcktRTWhNamM)">
<div class="social">
<i class="fa fa-facebook"></i>
<i class="fa fa-twitter"></i>
<i class="fa fa-google-plus"></i>
<i class="fa fa-envelope"></i>
</div>
</div>
<h5 class="image-caption">
<i class="fa fa-quote-left"></i>
Always find something new to learn every day
<i class="fa fa-quote-right"></i>
</h5>
<div class="readmore">View profile</i>
</i>
</div>
</div>
</div>
<!-- Staff 2 -->
<div class="animation-element multi-step-right cf">
<div class="gallery">
<h3 class="title">Jillian Jules</h3>
<h4 class="subtitle">Marketing</h4>
<div class="image" style="background-image: url(https://drive.google.com/uc?export=download&id=0B7UPM0QugWUjb1dxcGZEYUc0Z3M)">
<div class="social">
<i class="fa fa-facebook"></i>
<i class="fa fa-twitter"></i>
<i class="fa fa-google-plus"></i>
<i class="fa fa-envelope"></i>
</div>
</div>
<h5 class="image-caption">
<i class="fa fa-quote-left"></i>
Find new creative areas to expand
<i class="fa fa-quote-right"></i>
</h5>
<div class="readmore">View profile</i>
</i>
</div>
</div>
</div>
<!-- Staff 3 -->
<div class="animation-element multi-step-left cf">
<div class="gallery">
<h3 class="title">James O'Keffe</h3>
<h4 class="subtitle">Manager</h4>
<div class="image" style="background-image: url(https://drive.google.com/uc?export=download&id=0B7UPM0QugWUjTURta0pyMEtoUmc)">
<div class="social">
<i class="fa fa-facebook"></i>
<i class="fa fa-twitter"></i>
<i class="fa fa-google-plus"></i>
<i class="fa fa-envelope"></i>
</div>
</div>
<h5 class="image-caption">
<i class="fa fa-quote-left"></i>
Expanding possibilities with determination
<i class="fa fa-quote-right"></i>
</h5>
<div class="readmore">View profile</i>
</i>
</div>
</div>
</div>
<!-- Staff 4 -->
<div class="animation-element multi-step-right cf">
<div class="gallery">
<h3 class="title">Vivian Rymer</h3>
<h4 class="subtitle">HR</h4>
<div class="image" style="background-image: url(https://drive.google.com/uc?export=download&id=0B7UPM0QugWUjV3BseTMtcEU1T2M)">
<div class="social">
<i class="fa fa-facebook"></i>
<i class="fa fa-twitter"></i>
<i class="fa fa-google-plus"></i>
<i class="fa fa-envelope"></i>
</div>
</div>
<h5 class="image-caption">
<i class="fa fa-quote-left"></i>
Increasing skills, determination and workplace unity
<i class="fa fa-quote-right"></i>
</h5>
<div class="readmore">View profile</i>
</i>
</div>
</div>
</div>
</div>
/*These styles contain basic styles for fomatting along with our animation css*/
body {
font-size: 16px;
font-family: 'Open Sans', sans-serif;
font-weight: 400;
background: #efefef;
line-height: 170%;
overflow-x: hidden;
}
strong,
b {
font-weight: 600
}
h1,
h2,
h3,
h4,
h5,
h6 {
font-weight: 300;
line-height: 150%;
}
*,
*:before,
*:after {
box-sizing: border-box;
-moz-box-sizing: border-box;
-webkit-box-sizing: border-box;
}
/*clearfixes*/
.cf:before,
.cf:after {
content: " ";
display: table;
}
.cf:after {
clear: both;
}
.main-container {
background: #fff;
max-width: 1000px;
margin: 25px auto 25px auto;
position: relative;
}
.container {
position: relative;
padding: 25px;
}
.container:last-of-type {
padding-top: 0px;
}
/*animation element*/
.animation-element {
position: relative;
width: 22%;
margin: 0% 1.5% 3% 1.5%;
float: left;
}
/*4 grid layout*/
.animation-element:nth-of-type(4n-3) {
clear: left;
}
.animation-element:nth-of-type(4n-2) {}
.animation-element:nth-of-type(4n-1) {}
.animation-element:nth-of-type(4n-0) {
clear: right;
}
/*left fancy animastion*/
@-moz-keyframes left_animation {
0% {
opacity: 0;
-moz-transform: rotate(180deg) translate3d(100%, 100%, 0);
}
75% {
opacity: 0.8;
-moz-transform: rotate(-40deg);
}
100% {
opacity: 1;
-moz-transform: rotate(0deg) translate3d(0%, 0%, 0);
}
}
@-webkit-keyframes left_animation {
0% {
opacity: 0;
-webkit-transform: rotate(180deg) translate3d(100%, 100%, 0);
}
75% {
opacity: 0.8;
-webkit-transform: rotate(-40deg);
}
100% {
opacity: 1;
-webkit-transform: rotate(0deg) translate3d(0%, 0%, 0);
}
}
@keyframes left_animation {
0% {
opacity: 0;
transform: rotate(180deg) translate3d(100%, 100%, 0);
}
75% {
opacity: 0.8;
transform: rotate(-40deg);
}
100% {
opacity: 1;
transform: rotate(0deg) translate3d(0%, 0%, 0);
}
}
/*right fancy animation*/
@-moz-keyframes right_animation {
0% {
opacity: 0;
-moz-transform: rotate(180deg) translate3d(-100%, -100%, 0);
}
75% {
opacity: 0.8;
-moz-transform: rotate(40deg);
}
100% {
opacity: 1;
-moz-transform: rotate(0deg) translate3d(0%, 0%, 0);
}
}
@-webkit-keyframes right_animation {
0% {
opacity: 0;
-webkit-transform: rotate(180deg) translate3d(-100%, 100%, 0);
}
75% {
opacity: 0.8;
-webkit-transform: rotate(40deg);
}
100% {
opacity: 1;
-webkit-transform: rotate(0deg) translate3d(0%, 0%, 0);
}
}
@keyframes right_animation {
0% {
opacity: 0;
transform: rotate(180deg) translate3d(-100%, -100%, 0);
}
75% {
opacity: 0.8;
transform: rotate(40deg);
}
100% {
opacity: 1;
transform: rotate(0deg) translate3d(0%, 0%, 0);
}
}
/*Multi-step animation*/
.multi-step-left .gallery,
.multi-step-right .gallery {
position: relative;
opacity: 0;
/*prevents flicker as animation occurs*/
}
.multi-step-left.in-view .gallery {
-moz-animation: left_animation 1300ms ease-in both;
-webkit-animation: left_animation 1300ms ease-in both;
animation: left_animation 1300ms ease-in both;
}
.multi-step-right.in-view .gallery {
-moz-animation: right_animation 1300ms linear both;
-webkit-animation: right_animation 1300ms linear both;
animation: right_animation 1300ms linear both;
}
.gallery {
float: left;
width: 100%;
height: auto;
margin: 0% 1.33% 2.66% 1.33%;
}
.gallery .image {
background: #F5F5F5;
border: solid 1px #EAEAEA;
height: 0px;
width: 80%;
width: calc(100% - 40px);
padding-bottom: 100%;
padding-bottom: calc(100% - 40px);
background-size: cover;
background-position: bottom center;
position: relative;
border-radius: 50%;
margin-bottom: 10px;
}
.gallery:hover .image,
.gallery:active .image {}
.gallery .image-caption {
position: relative;
background: #fff;
background: #efefef;
color: #333;
font-size: 95%;
padding: 10px;
margin: 0px 0px 10px 0px;
}
.gallery .image-caption i {
color: #aaa;
margin: 0px 7px 0px 0px;
display: inline-block;
}
.gallery .image-caption i:last-child {
margin: 0px 0px 0px 7px;
}
.gallery .readmore {
padding: 5px 12px;
cursor: pointer;
text-align: center;
background: #2c3e50;
color: #fff;
font-size: 90%;
-moz-transition: all 350ms ease;
-o-transition: all 350ms ease;
-webkit-transition: all 350ms ease;
transition: all 350ms ease;
}
.gallery .readmore:hover,
.gallery .readmore:active {
background: #34495e;
}
.gallery .title {
margin: 0px 0px 5px 0px;
text-align: center;
color: #2c3e50;
font-weight: 400;
}
.gallery .subtitle {
margin: 0px 0px 10px 0px;
text-align: center;
}
.gallery .social {
position: absolute;
top: 0px;
right: -40px;
width: calc(35px);
}
.gallery .social i {
width: 100%;
display: block;
text-align: center;
height: 35px;
font-size: 125%;
background: #2c3e50;
line-height: 35px;
border-radius: 50%;
color: rgb(255, 255, 255);
margin-bottom: 5px;
cursor: pointer;
-moz-transition: all 350ms ease;
-o-transition: all 350ms ease;
-webkit-transition: all 350ms ease;
transition: all 350ms ease;
}
.gallery .social i:hover,
.gallery .social i:active {
background: #34495e;
}
/*media queries for small devices*/
@media screen and (max-width: 678px) {
.main-container {
margin: 25px;
}
.animation-element,
.animation-element:nth-of-type(4n-3),
.animation-element:nth-of-type(4n-2),
.animation-element:nth-of-type(4n-1),
.animation-element:nth-of-type(4n-0) {
width: 100%;
margin: 0% 0% 25px 0%;
}
}
var $animation_elements = $('.animation-element');
var $window = $(window);
function check_if_in_view() {
var window_height = $window.height();
var window_top_position = $window.scrollTop();
var window_bottom_position = (window_top_position + window_height);
$.each($animation_elements, function() {
var $element = $(this);
var element_height = $element.outerHeight();
var element_top_position = $element.offset().top;
var element_bottom_position = (element_top_position + element_height);
//check to see if this current container is within viewport
if ((element_bottom_position >= window_top_position) &&
(element_top_position <= window_bottom_position)) {
$element.addClass('in-view');
} else {
$element.removeClass('in-view');
}
});
}
$window.on('scroll resize', check_if_in_view);
$window.trigger('scroll');
Also see: Tab Triggers