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.
<!-- Design and content inspired from Giulio Cuscito :- https://dribbble.com/shots/7129691--Blue-Planet-Carousel-Concept -->
<header class='c-header'>
<h1 class='c-header__title'>Blue Planet</h1>
<nav class='c-navigation'>
<ul class='c-navigation__list'>
<li class='c-navigation__list-item c-navigation__list-item--active'><a href='#' title=''>Latest Articles</a></li>
<li class='c-navigation__list-item'><a href='#' title=''>Photos of the day</a></li>
<li class='c-navigation__list-item'><a href='#' title=''>Video Channel</a></li>
</ul>
</nav>
<div class='c-cta'>
<a href='' title=''>Subscribe</a>
<button class='c-cta__button c-cta__button__search'><svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 56.966 56.966"><path d="M55.146 51.887L41.588 37.786c3.486-4.144 5.396-9.358 5.396-14.786 0-12.682-10.318-23-23-23s-23 10.318-23 23 10.318 23 23 23c4.761 0 9.298-1.436 13.177-4.162l13.661 14.208c.571.593 1.339.92 2.162.92.779 0 1.518-.297 2.079-.837 1.192-1.147 1.23-3.049.083-4.242zM23.984 6c9.374 0 17 7.626 17 17s-7.626 17-17 17-17-7.626-17-17 7.626-17 17-17z"/></svg></button>
<button class='c-cta__button c-cta__button__menu'></button>
</div>
</header>
<div class='c-socials'>
<ul class='c-socials__list'>
<li class='c-socials__list-item'><a href='' title=''><svg height="512" viewBox="0 0 24 24" width="512" xmlns="http://www.w3.org/2000/svg"><path d="M3 24h9v-8.25H9V12h3V9c0-2.486 2.014-4.5 4.5-4.5h3v3.75H18c-.828 0-1.5-.078-1.5.75v3h3.75l-1.5 3.75H16.5V24H21c1.654 0 3-1.346 3-3V3c0-1.655-1.346-3-3-3H3C1.345 0 0 1.345 0 3v18c0 1.654 1.345 3 3 3z"/></svg></a></li>
<li class='c-socials__list-item'><svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 512 512"><path d="M512 97.248c-19.04 8.352-39.328 13.888-60.48 16.576 21.76-12.992 38.368-33.408 46.176-58.016-20.288 12.096-42.688 20.64-66.56 25.408C411.872 60.704 384.416 48 354.464 48c-58.112 0-104.896 47.168-104.896 104.992 0 8.32.704 16.32 2.432 23.936-87.264-4.256-164.48-46.08-216.352-109.792-9.056 15.712-14.368 33.696-14.368 53.056 0 36.352 18.72 68.576 46.624 87.232-16.864-.32-33.408-5.216-47.424-12.928v1.152c0 51.008 36.384 93.376 84.096 103.136-8.544 2.336-17.856 3.456-27.52 3.456-6.72 0-13.504-.384-19.872-1.792 13.6 41.568 52.192 72.128 98.08 73.12-35.712 27.936-81.056 44.768-130.144 44.768-8.608 0-16.864-.384-25.12-1.44C46.496 446.88 101.6 464 161.024 464c193.152 0 298.752-160 298.752-298.688 0-4.64-.16-9.12-.384-13.568 20.832-14.784 38.336-33.248 52.608-54.496z"/></svg>
<a href='' title=''></a>
</li>
<li class='c-socials__list-item'><a href='' title=''><svg height="512pt" viewBox="0 0 512 512.00006" width="512pt" xmlns="http://www.w3.org/2000/svg"><path d="M261.039062 512c-1.695312 0-3.390624 0-5.097656-.007812-40.132812.097656-77.214844-.921876-113.277344-3.117188-33.0625-2.011719-63.242187-13.4375-87.28125-33.039062-23.195312-18.914063-39.035156-44.488282-47.078124-76.003907-7-27.4375-7.371094-54.371093-7.726563-80.421875C.320312 300.71875.0546875 278.570312 0 256.046875c.0546875-22.617187.320312-44.765625.578125-63.457031.355469-26.046875.726563-52.980469 7.726563-80.421875C16.347656 80.652344 32.1875 55.078125 55.382812 36.164062 79.421875 16.5625 109.601562 5.136719 142.667969 3.125 178.730469.933594 215.820312-.0898438 256.039062.0078125 296.183594-.078125 333.253906.933594 369.316406 3.125c33.0625 2.011719 63.242188 13.4375 87.28125 33.039062 23.199219 18.914063 39.035156 44.488282 47.078125 76.003907 7 27.4375 7.371094 54.375 7.726563 80.421875.257812 18.691406.527344 40.839844.578125 63.363281v.09375c-.050781 22.523437-.320313 44.671875-.578125 63.363281-.355469 26.046875-.722656 52.980469-7.726563 80.421875-8.042969 31.515625-23.878906 57.089844-47.078125 76.003907-24.039062 19.601562-54.21875 31.027343-87.28125 33.039062C334.78125 510.976562 299.304688 512 261.039062 512zm-5.097656-40.007812c39.480469.09375 75.730469-.902344 110.945313-3.042969 25-1.519531 46.675781-9.632813 64.433593-24.113281 16.414063-13.386719 27.71875-31.855469 33.597657-54.894532 5.828125-22.839844 6.164062-47.363281 6.488281-71.078125.253906-18.566406.519531-40.558593.574219-62.863281-.054688-22.308594-.320313-44.296875-.574219-62.863281-.324219-23.714844-.660156-48.238281-6.488281-71.082031-5.878907-23.039063-17.183594-41.507813-33.597657-54.894532-17.757812-14.476562-39.433593-22.589844-64.433593-24.109375-35.214844-2.144531-71.464844-3.132812-110.851563-3.046875-39.472656-.09375-75.726562.902344-110.941406 3.046875-25 1.519531-46.675781 9.632813-64.433594 24.109375-16.414062 13.386719-27.71875 31.855469-33.597656 54.894532-5.828125 22.84375-6.164062 47.363281-6.488281 71.082031-.253907 18.582031-.519531 40.585937-.574219 62.910156.054688 22.226563.320312 44.234375.574219 62.816406.324219 23.714844.660156 48.238281 6.488281 71.078125 5.878906 23.039063 17.183594 41.507813 33.597656 54.894532 17.757813 14.476562 39.433594 22.589843 64.433594 24.109374 35.214844 2.144532 71.476562 3.144532 110.847656 3.046876zM254.988281 381c-68.921875 0-125-56.074219-125-125s56.078125-125 125-125c68.925781 0 125 56.074219 125 125s-56.074219 125-125 125zm0-210c-46.867187 0-85 38.132812-85 85s38.132813 85 85 85c46.871094 0 85-38.132812 85-85s-38.128906-85-85-85zm139-80c-16.566406 0-30 13.429688-30 30s13.433594 30 30 30c16.570313 0 30-13.429688 30-30s-13.429687-30-30-30zm0 0"/></svg></a></li>
</ul>
</div>
<section class='c-slider'>
<div class='c-slider-init'>
<div class='c-slide' style='background-image:url("https://images.unsplash.com/photo-1504461407194-07c608d0989b?ixlib=rb-1.2.1&ixid=eyJhcHBfaWQiOjEyMDd9&auto=format&fit=crop&w=1900&q=100")'>
<div class='c-slide-content'>
<div class='c-wrap c-wrap--line'>
<h2 class='c-slide__title'>
Underwater
<span class='c-slide__title--large'>Monsters</span>
</h2>
</div>
<div class='c-wrap c-wrap--small'>
<div class='c-slide__info'>
<h3 class='c-slide__subtitle'>Saltwater Crocodile</h3>
<p class='c-slide__body'>Lorem ipsum dolor sit amet, consectetur adipiscing elit, sed do eiusmod tempor incididunt ut labore et dolore magna aliqua.
</p>
</div>
</div>
</div>
</div>
<div class='c-slide' style='background-image:url("https://images.unsplash.com/photo-1544745494-3d8dd3fa1564?ixlib=rb-1.2.1&ixid=eyJhcHBfaWQiOjEyMDd9&auto=format&fit=crop&w=1900&q=100")'>
<div class='c-slide-content'>
<div class='c-wrap c-wrap--line'>
<h2 class='c-slide__title'>
The
<span class='c-slide__title--medium'>Gates of Hell</span>
</h2>
</div>
<div class='c-wrap c-wrap--small'>
<div class='c-slide__info'>
<h3 class='c-slide__subtitle'>Special inside volcanoes</h3>
<p class='c-slide__body'>Lorem ipsum dolor sit amet, consectetur adipiscing elit, sed do eiusmod tempor incididunt ut labore et dolore magna aliqua.
</p>
</div>
</div>
</div>
</div>
<div class='c-slide' style='background-image:url("https://images.unsplash.com/photo-1528214096798-37891d32174c?ixlib=rb-1.2.1&ixid=eyJhcHBfaWQiOjEyMDd9&auto=format&fit=crop&w=1900&q=100")'>
<div class='c-slide-content'>
<div class='c-wrap c-wrap--line'>
<h2 class='c-slide__title'>
Exploring
<span class='c-slide__title--large'>Deep Caves</span>
</h2>
</div>
<div class='c-wrap c-wrap--small'>
<div class='c-slide__info'>
<h3 class='c-slide__subtitle'>Real Time Capsules</h3>
<p class='c-slide__body'>Lorem ipsum dolor sit amet, consectetur adipiscing elit, sed do eiusmod tempor incididunt ut labore et dolore magna aliqua.
</p>
</div>
</div>
</div>
</div>
</div>
</section>
// colors
$white: hsl(0, 0%, 100%);
$orange: hsl(3, 100%, 63%);
* {
box-sizing: border-box;
margin: 0;
padding: 0;
}
body {
font-family: "Roboto", sans-serif;
background: black;
overflow: hidden;
}
a {
text-decoration: none;
}
h1,
h2,
h3,
h4,
h5,
h6,
ul,
li,
p,
a,
button {
color: $white;
}
h2 {
font-family: "Cormorant Garamond", serif;
font-weight: 300;
}
.c-header {
display: flex;
align-items: center;
padding: 2rem;
position: absolute;
top: 0;
left: 0;
z-index: 2;
width: 100%;
}
.c-header__title {
text-transform: uppercase;
font-size: 1.5em;
margin: 0 2rem;
}
.c-navigation {
flex-basis: 70%;
}
.c-navigation__list {
padding: 0;
}
.c-navigation__list-item {
display: inline-block;
margin: 0 2rem;
position: relative;
text-transform: uppercase;
font-size: 0.9em;
opacity: 0.7;
font-weight: 500;
&:after {
content: "";
width: 2px;
height: 100%;
background: $white;
position: absolute;
display: inline-block;
right: -2rem;
}
}
.c-navigation__list-item:last-of-type {
&:after {
background: transparent;
}
}
.c-navigation__list-item--active {
opacity: 1;
> a {
position: relative;
&:after {
content: "";
width: 100%;
height: 1px;
background-color: $orange;
position: absolute;
bottom: -0.4rem;
left: 0;
}
}
}
.c-cta {
display: flex;
align-items: center;
> a {
font-size: 0.9em;
opacity: 0.7;
font-weight: 500;
text-transform: uppercase;
margin: 0 2rem;
}
}
.c-cta__button {
border: 0;
background-color: transparent;
display: inline-block;
}
.c-cta__button__search {
width: 15px;
height: 15px;
margin-right: 3rem;
svg {
width: inherit;
height: inherit;
fill: $white;
}
}
.c-cta__button__menu {
width: 20px;
height: 2px;
background-color: $white;
position: relative;
&:after,
&:before {
content: "";
width: inherit;
height: inherit;
background-color: inherit;
position: absolute;
left: 0;
}
&:after {
bottom: -5px;
}
&:before {
top: -5px;
}
}
.c-socials {
position: fixed;
bottom: 0;
left: 0;
background-color: $white;
padding: 1.8rem 1.8rem 0.8rem 1.8rem;
z-index: 2;
}
.c-socials__list {
}
.c-socials__list-item {
margin-bottom: 1rem;
a svg {
width: 21px;
height: 21px;
}
}
.c-slider {
}
.c-slider-init {
}
.c-slide {
display: inline-flex !important;
align-items: center;
width: 100%;
height: 100vh;
background-position: center;
background-size: cover;
will-change:background-size;
position: relative;
transition:1s ease;
transition-delay:.4s;
&:after {
content: "";
width: 100%;
height: 100%;
position: absolute;
top: 0;
left: 0;
background: -moz-linear-gradient(
top,
rgba(0, 0, 0, 0) 0%,
rgba(0, 0, 0, 0.61) 76%
);
background: -webkit-linear-gradient(
top,
rgba(0, 0, 0, 0) 0%,
rgba(0, 0, 0, 0.61) 76%
);
background: linear-gradient(
to bottom,
rgba(0, 0, 0, 0) 0%,
rgba(0, 0, 0, 0.61) 76%
);
filter: progid:DXImageTransform.Microsoft.gradient(
startColorstr="#00000000",
endColorstr="#9c000000",
GradientType=0
);
}
}
.c-slide-content {
padding: 2rem;
margin: 0 auto;
width: 100%;
z-index: 2;
max-width: 1200px;
}
.c-slide__title {
font-size: 4em;
text-transform: uppercase;
letter-spacing: 20px;
transform: translateY(150px);
opacity: 0;
transition: 0.8s ease;
will-change: opacity, transform;
}
.c-slide__title--large,
.c-slide__title--medium {
display: block;
font-size: 2.5em;
line-height: 110px;
transform: translateY(150px);
will-change: transform;
transition-delay: 0.4s;
position: relative;
transition: 1s ease;
}
.c-slide__title--medium {
font-size: 1.6em;
line-height: 100px;
}
.c-slide__subtitle {
text-transform: uppercase;
letter-spacing: 3px;
}
.c-slide__body {
margin-top: 0.7rem;
opacity: 0;
line-height: 27px;
}
.c-slide__info {
transform: translateY(-150px);
transition: 0.8s ease;
}
.c-wrap {
padding: 2rem 0;
overflow: hidden;
}
.c-wrap--small {
max-width: 30%;
}
.c-wrap--line {
position: relative;
&:after {
content: "";
position: absolute;
left: 50%;
transform: translateX(-50%);
width: 0;
height: 1px;
background-color: $white;
bottom: 0;
transition: 0.9s ease;
transition-delay: 0.4s;
}
}
.slick-list {
overflow: visible !important;
}
.animateIn,
.initialAnimation {
.c-slide__title--large,
.c-slide__title--medium,
.c-slide__info,
.c-slide__title,
.c-slide__body{
transform: translateY(0);
opacity: 1;
}
.c-wrap--line {
&:after {
left: 0;
transform: translateX(0);
width: 100%;
}
}
}
.slick-list {
transition: 0.5s ease;
}
.u-scale-out {
transform: scale(0.6) !important;
transition: 0.5s ease;
}
.u-scale-in {
transform: scale(1);
}
@media only screen and (max-width: 1300px) {
.c-slide__title {
font-size:3em
}
.c-slide__title--large {
font-size:2em;
}
.c-wrap--small {
max-width:50%;
}
}
@media only screen and ( max-width: 1100px) {
.c-navigation {
display:none;
}
.c-header {
justify-content:space-between;
}
}
@media only screen and (max-width: 800px) {
.c-slide__title--medium {
font-size:1.3em;
}
.c-slide__title {
font-size:2.5em
}
.c-slide__title--large {
font-size:1.5em;
}
.c-wrap--small {
max-width:80%;
}
}
jQuery(document).ready(function() {
jQuery(".c-slider-init").slick({
dots: false,
nav: false,
arrows: false,
infinite: true,
speed: 1200,
autoplaySpeed: 5000,
slidesToShow: 1,
adaptiveHeight: true,
autoplay: true,
draggable: false,
pauseOnFocus: false,
pauseOnHover: false
});
jQuery(".slick-current").addClass("initialAnimation");
let transitionSetup = {
target: ".slick-list",
enterClass: "u-scale-out",
doTransition: function() {
var slideContainer = document.querySelector(this.target);
slideContainer.classList.add(this.enterClass);
jQuery(".slick-current").removeClass("animateIn");
},
exitTransition: function() {
var slideContainer = document.querySelector(this.target);
setTimeout(() => {
slideContainer.classList.remove(this.enterClass);
jQuery(".slick-current").addClass("animateIn");
}, 2000);
}
};
var i = 0;
// On before slide change
jQuery(".c-slider-init").on("beforeChange", function(
event,
slick,
currentSlide,
nextSlide
) {
if (i == 0) {
event.preventDefault();
transitionSetup.doTransition();
i++;
} else {
i = 0;
transitionSetup.exitTransition();
}
jQuery(".c-slider-init").slick("slickNext");
jQuery(".slick-current").removeClass("initialAnimation");
});
});
Also see: Tab Triggers