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.
<head>
<link href="https://fonts.googleapis.com/css?family=Roboto:300,400,700,900" rel="stylesheet">
<link rel="stylesheet" href="https://maxcdn.bootstrapcdn.com/font-awesome/4.7.0/css/font-awesome.min.css">
</head>
<body>
<div class="links">
<a href="https://github.com/thesheepman" class='git'><i class="fa fa-github" aria-hidden="true"></i></a>
<a class="dribble" href='https://dribbble.com/shots/3678061-Card-Animation'><i class="fa fa-dribbble" aria-hidden="true"></i></a></div>
<div class="card aqua active">
<div class="card-month">
<div class="card-month__name">july</div>
<div class="card-month__divider"></div>
<div class="card-month__date">17</div>
</div>
<div class="card-image"></div>
<div class="card-content">
<div class="card-content__author">
<div class="author__divider"></div>
<div class="author__name">Andrey Andrey</div>
</div>
<div class="card-content__title">The Blue Waves</div>
<div class="card-content__text">
<div class="text__time"><i class="fa fa-clock-o" aria-hidden="true"></i> 8 minutes read</div>
<div class="text__content">
<i>Lorem ipsum dolor sit amet consectetur adipisicing elit. Voluptatum error cumque repellat atque amet, officiis commodi quos explicabo dignissimos. Saepe.</i>
<a class="text__content__button" href='#'><i class="fa fa-play-circle" aria-hidden="true"></i></a>
</div>
</div>
<div class="card-content__nav" style='justify-content: flex-end'>
<!-- <a class="nav__prev" href='#'>prev</a> -->
<a class="nav__next" href='#'>next</a>
</div>
</div>
</div>
<div class="card green">
<div class="card-month">
<div class="card-month__name">june</div>
<div class="card-month__divider"></div>
<div class="card-month__date">21</div>
</div>
<div class="card-image"></div>
<div class="card-content">
<div class="card-content__author">
<div class="author__divider"></div>
<div class="author__name">Igor Mathewshonok</div>
</div>
<div class="card-content__title">A Green Revolution</div>
<div class="card-content__text">
<div class="text__time"><i class="fa fa-clock-o" aria-hidden="true"></i> 3 minutes read</div>
<div class="text__content">
<i>Lorem ipsum dolor sit amet consectetur adipisicing elit. Voluptatum error cumque repellat atque amet, officiis commodi quos explicabo dignissimos. Saepe.</i>
<a class="text__content__button" href='#'><i class="fa fa-play-circle" aria-hidden="true"></i></a>
</div>
</div>
<div class="card-content__nav">
<a class="nav__prev" href='#'>prev</a>
<a class="nav__next" href='#'>next</a>
</div>
</div>
</div>
<div class="card ochra">
<div class="card-month">
<div class="card-month__name">March</div>
<div class="card-month__divider"></div>
<div class="card-month__date">17</div>
</div>
<div class="card-image"></div>
<div class="card-content">
<div class="card-content__author">
<div class="author__divider"></div>
<div class="author__name">Abstract Museum</div>
</div>
<div class="card-content__title">The Mystery Path</div>
<div class="card-content__text">
<div class="text__time"><i class="fa fa-clock-o" aria-hidden="true"></i> 17 minutes read</div>
<div class="text__content">
<i>Lorem ipsum dolor sit amet consectetur adipisicing elit. Voluptatum error cumque repellat atque amet, officiis commodi quos explicabo dignissimos. Saepe.</i>
<a class="text__content__button" href='#'><i class="fa fa-play-circle" aria-hidden="true"></i></a>
</div>
</div>
<div class="card-content__nav">
<a class="nav__prev" href='#'>prev</a>
<a class="nav__next" href='#'>next</a>
</div>
</div>
</div>
</body>
// Vars
$aqua: #40daae
$green: #8fc30f
$ochra: #f7c549
$font-size: 14px
$animation-speed: .3s
@keyframes width-animate
0%
opacity: 0
width: 10%
100%
opacity: 1
width: 45%
@keyframes width-animate-back
0%
opacity: 1
width: 45%
100%
opacity: 0
width: 10%
//Main
body
font-family: 'Roboto', sans-serif
font-size: $font-size
color: #353535
.links
list-style: none
float: left
a
display: block
color: #353535
font-size: 3em
margin-left: 100px
transition: .3s
&.dribble:hover
color: #ea4c89
&.git:hover
color: #f7c549
.inactive
.card-image:before
animation: width-animate-back $animation-speed forwards !important
.author__divider
animation: width-animate-back $animation-speed forwards !important
.active
display: flex !important
.card-image:before
animation: width-animate $animation-speed forwards
.author__divider
animation: width-animate $animation-speed forwards
.card
&:last-of-type
.nav__next
display: none
.card
overflow: hidden
display: none
flex-flow: row wrap
justify-content: flex-start
box-shadow: 0px 0px 30px rgba(0, 0, 0, 0.5)
width: 60%
margin: 0 auto
position: relative
height: 100vh
.card-content
padding: 2em 2em 2em 3em
display: flex
flex-direction: column
width: 40%
justify-content: space-between
.card-content__nav
display: flex
justify-content: space-between
flex-flow: row wrap
margin-top: 1em
a
text-decoration: none
color: #585858
font-weight: 700
text-transform: uppercase
transition: .2s
&:hover
color: #ababab
.card-content__text
.text__content
color: #a7a7a7
margin: 2em 0em
position: relative
&:after
background: linear-gradient(to top, #fff 0, transparent 100%)
content: " "
width: 100%
height: 50%
position: absolute
left: 0
bottom: 0
.text__content__button
cursor: pointer
position: absolute
font-size: 4em
top: -10px
left: 45%
.text__time
margin: 1em 0em
.fa-clock-o
padding-right: 10px
color: #a7a7a7
.card-content__title
font-weight: 900
font-size: 2em
color: #252525
.card-content__author
display: flex
flex-flow: row wrap
justify-content: space-between
position: relative
margin-bottom: 2em
.author__divider
width: 50%
height: 1em
position: relative
top: 3px
.author__name
font-weight: 700
font-size: 1.2em
.card-image
width: 45%
transition: width 2s
&:before
content: ""
position: absolute
width: 5%
height: 100%
background-size: cover
background-position: center center
transition: width 2s
.card-month
padding: 2em 1em
display: flex
flex-direction: column
justify-content: space-around
.card-month__name
text-orientation: upright
writing-mode: vertical-rl
letter-spacing: 1em
text-transform: uppercase
font-weight: 900
.card-month__divider
height: 10em
background: #000
width: 3px
margin-left: 8px
margin-top: 2em
margin-bottom: 2em
.card-month__date
font-weight: 900
// Custom Cards
&.aqua
.card-month__divider
background: $aqua
.card-image:before
background-image: url(http://i.imgur.com/Etx8s9g.jpg)
.author__divider
background: $aqua
.text__content__button i
color: $aqua
text-shadow: 0px 0px 10px $aqua
&.green
.card-month__divider
background: $green
.card-image:before
background-image: url(http://i.imgur.com/X5CqPG8.jpg)
.author__divider
background: $green
.text__content__button i
color: $green
text-shadow: 0px 0px 10px $green
&.ochra
.card-month__divider
background: $ochra
.card-image:before
background-image: url(http://i.imgur.com/NayL3CM.jpg)
.author__divider
background: $ochra
.text__content__button i
color: $ochra
text-shadow: 0px 0px 10px $ochra
var animationSpeed = 250; //ms
var activeClass = "active";
var inactiveClass = "inactive";
$(".nav__next").click(function() {
event.preventDefault();
$(".card.active").addClass(inactiveClass);
setTimeout(function() {
$(".card.active").removeClass(activeClass).next().addClass(activeClass);
}, animationSpeed);
});
$(".nav__prev").click(function() {
event.preventDefault();
$(".card.active").addClass(inactiveClass);
setTimeout(function() {
$(".card.active")
.removeClass(activeClass)
.removeClass(inactiveClass)
.prev()
.removeClass(inactiveClass)
.addClass(activeClass);
}, animationSpeed);
});
Also see: Tab Triggers