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.
<!--
**STILL A WORK IN PROGRESS, decided to make public to give a little teaser**
I personally renamed these cards: Concord Cards.
Its named after the definition and after the british Airlines concord jet because of how fast and convenient. Though it did combust 🤔. Lets hope mine doesn't.-->
<body class="">
<main class="concord" id="concord-cards">
<header>
<time>
<h5 id="date">January 30</h5>
<h3 id="day">Today</h3>
</time>
<a href="https://twitter.com/rtarson" target="_blank"><avatar style="background-image:url(https://s3-us-west-2.amazonaws.com/s.cdpn.io/565097/profile.jpg)"></avatar></a>
</header>
<!--
Card = Original Card white bttom
Card i = Icon/Image with price
Card x = Card without icon and footer
Card V = Card with video-->
<div class="card xl">
<input type="button" class="concord exit" value="×"/>
<section class="wrapper">
<img style="background-image: url(https://images.unsplash.com/photo-1512941937669-90a1b58e7e9c?ixlib=rb-0.3.5&q=85&fm=jpg&crop=entropy&cs=srgb&ixid=eyJhcHBfaWQiOjE0NTg5fQ&s=20d7566d9a01308a05afe81482e5b493)" alt=""></img>
<footer class="card-footer">
<h6>How To</h6>
<h4>Stitch Screenshots the Easy Way</h4>
<p>Tap to learn how to save long web paes and chat threads.</p>
</footer>
</section>
<div class="content">
</div>
</div>
<div class="card x" data-color="" style="">
<input type="button" class="concord exit" value="×"/>
<section class="wrapper">
<img style="background-color: #ffcbb6; background-image: url(https://s3-us-west-2.amazonaws.com/s.cdpn.io/565097/city-landscape-vector.png)" alt=""></img>
<header class="card-title">
<h6>Life Hack</h6>
<h4>Stitch Screenshots the Easy Way</h4>
</header>
<footer class="card-footer">
<p>Tap to learn how to save long web paes and chat threads.</p>
</footer>
</section>
<div class="content">
<p><b>Lorem ipsum dolor sit amet</b> consectetur adipiscing elit. Quisque lacinia, turpis ac congue vehicula, ipsum enim semper neque, nec ultrices mauris dui non neque. Phasellus libero purus, viverra sit amet consectetur at, sagittis vel turpis. Quisque nec nulla quis neque pharetra
volutpat. Etiam sodales odio eu eros dictum efficitur. </p>
<img alt="" style="background-image:url(https://images.unsplash.com/photo-1460925895917-afdab827c52f?ixlib=rb-0.3.5&q=85&fm=jpg&crop=entropy&cs=srgb&ixid=eyJhcHBfaWQiOjE0NTg5fQ&s=64aea2d5c42b610bb0ed8aede22c2507)"/>
<p>In elementum finibus dui, ac rutrum ante consectetur sit amet. Aenean mauris sem, pulvinar vel tempor vel, volutpat sed turpis. Vestibulum arcu est, blandit ac ex et, ultrices consequat est.</p>
</div>
</div>
<header class="cards">
<time>
<h5 id="date">January 29</h5>
<h3 id="day">Monday</h3>
</time>
</header>
<div class="card xl i">
<input type="button" class="concord exit" value="×"/>
<section class="wrapper">
<img style="background-color: #FED8C1; background-image: url(https://s3-us-west-2.amazonaws.com/s.cdpn.io/565097/mountain-landscape-vector.png);" alt=""></img>
<header class="card-title">
<img class="icon" style="background-image: url(https://s3-us-west-2.amazonaws.com/s.cdpn.io/565097/leaf-icon.jpg);"></img>
<h2>App of the Day</h2>
</header>
<footer class="card-footer">
<h6>Khan Academy</h6>
<p>You can learn anything</p>
<input type="button" class="concord" value="$4.99"></input>
</footer>
</section>
<div class="content">
</div>
</div>
<div class="card v">
<input type="button" class="concord exit" value="×"/>
<section class="wrapper">
<video loop="true" src="https://taurozza.com/assets/videos/lasvegas.mp4" alt=""></video>
<footer class="card-footer">
<h6>How To</h6>
<h4>Stitch Screenshots the Easy Way</h4>
<p>Tap to learn how to save long web paes and chat threads.</p>
</footer>
</section>
<div class="content">
</div>
</div>
</main>
</body>
@font-face {
font-family: Roboto;
src: url("https://s3-us-west-2.amazonaws.com/s.cdpn.io/565097/Roboto-Regular.woff2")
format("woff2"),
url("https://s3-us-west-2.amazonaws.com/s.cdpn.io/565097/Roboto-Regular.woff")
format("woff"),
url("https://s3-us-west-2.amazonaws.com/s.cdpn.io/565097/Roboto-Regular.ttf")
format("ttf");
font-weight: 400;
font-style: normal;
}
*, *:before, *:after {
-moz-box-sizing: border-box;
-webkit-box-sizing: border-box;
box-sizing: border-box;
}
body,
html {
padding: 0;
height: 100%;
width: 100%;
}
body.scroll-off{
overflow-y: hidden;
}
html,
body,
div,
span,
applet,
object,
iframe,
title,
p {
margin: 0;
padding: 0;
border: 0;
font-size: 100%;
font: inherit;
vertical-align: baseline;
font-family: "Roboto";
}
h1,
h2,
h3,
h4,
h5,
h6 {
margin: 0;
font-size: 100%;
vertical-align: baseline;
font-family: "Roboto";
font-weight: 600;
}
h1 {
font-size: 3em;
}
h2 {
font-size: 2.6em;
}
h3 {
font-size: 2em;
}
h4 {
font-size: 1.5em;
}
h5 {
font-size: 1em;
}
h6 {
font-size: 0.8em;
}
/* ================================= *
* Cards outer Styling
==================================== */
main.concord {
margin: 20px 0;
text-align: center;
}
.concord > header {
width: 90%;
padding: 0px 15px 0px 15px;
margin: 0 auto;
position: relative;
display: block;
overflow: auto;
text-align: left;
}
.concord > header time {
display: table-cell;
float: left;
color: black;
}
.concord > header time:first-child {
color: #8f8f91;
}
.concord > header time h3 {
color: black;
font-weight: 700;
}
.concord > header avatar{
display: table-cell;
text-align: right;
float: right;
background-position: center;
background-size: 120%;
background-repeat: no-repeat;
border-radius: 50%;
height: 50px;
width: 50px;
}
/* ================================= *
* Card Styling + Default
==================================== */
.card {
z-index: 1;
cursor: pointer;
display: inline-block;
position: static;
text-align: left;
width: 89%;
height: 400px;
max-height: 400px;
border-radius: 10px;
margin: 15px 8px;
overflow: hidden;
background: white;
box-shadow: 0px 4px 5px 0px rgba(0, 0, 0, 0.10),
0px 1px 20px 0px rgba(0, 0, 0, 0.10);
transform-origin: center;
transition: transform, width, height, border-radius, top, left;
transition-duration: 500ms;
transition-timing-function: ease-in-out;
-moz-user-select: none;
-webkit-user-select: none;
-ms-user-select:none;
user-select:none;
-o-user-select:none;
}
.card.gate_reserved{
box-shadow: none;
}
.card .wrapper {
height: 100%;
width: 100%;
position: relative;
display: table;
}
.card h5,
.card h6,
.card p {
margin: 4px 0;
}
.card h6,
.card p {
color: #8f8f91;
}
.card h6 {
text-transform: uppercase;
}
.card video,
.card img {
display: table-cell;
position: relative;
width: 100%;
height: 100%;
background-position: center;
background-size: cover;
background-repeat: no-repeat;
}
.card > .wrapper > header,
.card > .wrapper > footer{
display: table-cell;
width: 100%;
height: auto;
padding: 15px 20px;
box-sizing: border-box;
}
.card > .wrapper > footer{
background: white;
position: absolute;
bottom: 0;
left: 0;
}
.card:active {
transform: scale(0.97);
}
/* Card Style: x */
.card.x h4,
.card.x p {
color: white;
}
.card.x h6 {
color: rgba(255, 255, 255, 0.65);
}
.card.x > .wrapper > header,
.card.x > .wrapper > footer {
position: absolute;
left: 0;
background: transparent;
padding: 15px 20px;
}
.card.x > .wrapper > header {
top: 0;
}
.card.x > .wrapper > footer {
bottom: 0;
}
/* Card Style: v */
.card.v .wrapper{display: block;}
.card.v video{object-fit: cover;}
.card.v video:before{
position: absolute;
right: 15px;
top: 0;
background: rgba(255,255,255,0.3);
content: "mute";
}
/* Card Style: i */
.card.i h2,
.card.i h6,
.card.i p{
color: white;
}
.card.i h2{
width: 50%;
text-transform: uppercase;
}
.card.i p{
font-size: 0.7em;
}
.card.i > .wrapper > header,
.card.i > .wrapper > footer {
position: absolute;
left: 0;
padding: 15px 20px;
}
.card.i > .wrapper > header{
top: 0;
}
.card.i > .wrapper > header img{
width: 70px;
height: 70px;
border-radius: 18px;
background-position: center;
background-size: cover;
background-repeat: no-repeat;
background-color: white;
}
.card.i > .wrapper > footer {
background: transparent;
bottom: 0;
}
button.card{
position: relative;
height: auto;
width: auto;
border: 0;
outline: 0;
font-weight: 600;
color: rgba(28, 111, 215, 0.88);
text-align: left;
background: rgba(255,255,255,0.95);
border-radius: 20px;
padding: 4.4px 13px;
}
/* Card Style~input styling*/
input[type="button"].concord{
cursor: pointer;
position: absolute;
height: auto;
width: auto;
border: 0;
outline: 0;
font-weight: 600;
color: rgba(28, 80, 245, 0.98);
text-align: left;
background: rgba(255,255,255,0.95);
border-radius: 20px;
padding: 4.4px 13px;
margin: 0;
right: 20px;
bottom: 19px;
box-sizing: border-box;
}
input[type="button"].concord:active{
color: rgba(28, 80, 245, 0.48);
}
input[type="button"].concord.exit{
display: none;
z-index: 99;
top: 15px;
right: 20px;
bottom: initial;
padding: 2px 6px;
font-size: 1.2em;
line-height: 1em;
color: rgba(255,255,255,0.75);
background: rgba(20,20,25,0.65);
}
input[type="button"].concord-exit:active{
color: rgba(28, 80, 245, 0.48);
}
/* Card State: Content and Card active Styling*/
.card > .content{
margin-top: 60px;
margin-bottom: 20px;
opacity: 0;
width: 100%;
height: 0px;
transition: height, opacity, margin;
transition-duration: 900ms;
transition-timing-function: ease-in-out;
}
.card > .content p{
margin: 35px 20px;
color: #8f8f91;
}
.card > .content p + p{
margin-top: 0;
}
.card > .content p > b{
color: black;
}
.card > .content img{
position: relative;
display: block;
width: 100%;
height: 300px;
background-position: center;
background-repeat: no-repeat;
background-size: cover;
}
.card > .content img:after{
}
.card.in-flight{
cursor: default;
z-index: 98;
display: block;
max-height: none;
max-width: none;
top: 40px!important;
height: 95vh !important;
width: 100vw !important;
margin: 0;
overflow-y: scroll;
transform: none;
border-bottom-left-radius: 0;
border-bottom-right-radius: 0;
}
.card.active:hover{
transform: none;
}
.card.in-flight > .wrapper{
height: 55%;
}
.card.in-flight > input[type="button"].concord.exit{
display: block;
}
.card.in-flight > .content{
margin-top: 0px;
height: 45%;
background: white;
opacity: 1;
}
@media screen and (min-width: 530px){
.card{
width: 75%;
}
}
@media screen and (min-width: 600px){
.card{
max-width:340px;
width: 65%;
}
}
@media screen and (max-width: 599px){
.card.in-flight{
border-radius: 0;
max-width: 100%;
top: 0!important;
left:0!important;
}
}
@media screen and (min-width: 600px){
.card.in-flight{
left: calc((100vw - 460px) / 2)!important;
max-width: 460px!important;
}
}
@media screen and (min-width: 730px){
.card{
max-width:340px;
width: 40%;
}
.card.in-flight{
left: calc((100vw - 700px) / 2)!important;
max-width: 700px!important;
}
}
@media screen and (min-width: 1000px){
.card{
width: 340px;
}
.card.xl{
width: 600px;
max-width: 600px;
}
.card.xl.active{
width: 100%;
max-width: 700px;
}
}
/* Before Concord can Depart you have to initialize it by adding <main class="concord" id="concord-cards">
Keep checking back for updates. I'm going to make the concords self generating so when JSON updates the cards will generate
*/
(function($) {
var $concord = $('#concord-cards'),
$card = $concord.find('.card'),
$cardEx = $card.find('.concord.exit'),
$scrollStatus,
$cardOrigin;
//calls card Taxiing to setup cards
$(document).ready(function() {
concordTaxiing($concord);
})
//card click function
$card.click(function(e) {
if ($(this).hasClass('card')) {
if (!$(this).hasClass('in-flight')) {
$(this).concordDeparture();
} else if ($(e.target).hasClass('concord exit')) {
$(e.target).parent().concordArrival();
}
}
});
//turns on off video if in viewport
$(window).on('resize scroll load', function() {
$scrollStatus = !0
}), setInterval(function() {
$scrollStatus && (concordGetVisuals(), $scrollStatus = !1);
}, 350);
function concordTaxiing($concord){
}
//when card zooms in
$.fn.concordDeparture = function(){
$this = $(this);
if ($this.hasClass('in-flight')) return;
var $vpHeight = $(window).height(),
$vpWidth = $(window).width();
$cardOrigin = $this.position();
$this.css({
'position': 'fixed',
'z-index': '98',
'top': $cardOrigin.top,
'left': $cardOrigin.left,
});
$this.before('<div class="card gate_reserved"></div>');
$('.gate_reserved').css({
'width': $this.width,
'height': $this.height
});
$('body').addClass('scroll-off');
$this.addClass('in-flight');
}
$.fn.concordArrival = function() {
$this = $(this);
$this.css({
'top': 'auto',
'left': 'auto',
'position': 'static'
})
$('.gate_reserved').remove();
$('body').removeClass('scroll-off');
$this.removeClass('in-flight');
}
function concordGetVisuals() {
$($card.find('video')).each(function() {
if ($(this).isOnScreen()) {
$(this).get(0).play();
} else {
$(this).get(0).pause();
}
});
}
$.fn.isOnScreen = function() {
var win = $(window);
var viewport = {
top: win.scrollTop(),
left: win.scrollLeft()
};
viewport.right = viewport.left + win.width();
viewport.bottom = viewport.top + win.height();
var bounds = this.offset();
bounds.right = bounds.left + this.outerWidth();
bounds.bottom = bounds.top + this.outerHeight();
return (!(viewport.right < bounds.left || viewport.left > bounds.right || viewport.bottom < bounds.top || viewport.top > bounds.bottom));
};
})(jQuery);
Also see: Tab Triggers