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 URL's 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 it's URL and the proper URL extention.
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.
<div class="link-box"><a href="https://dribbble.com/shots/2833787-Payment-Ux" target="_blank">Original version</a></div>
<div class="container">
<div class="top">
<div class="hamburger">
<span></span>
<span></span>
<span></span>
</div>
<div class="card">
<div class="card-front">
<div class="number">
<code>6214 •••• •••• 3266</code>
</div>
<div class="due-date">
Due 11/19
</div>
<svg class="visa" xmlns="http://www.w3.org/2000/svg" version="1.1" width="101.25" height="35">
<g transform="matrix(1.25,0,0,-1.25,0,35)">
<g transform="scale(0.1,0.1)">
<path d="m 401.02,266.949 -54.11,-252.9685 -65.43,0 54.11,252.9685 65.43,0 z m 275.308,-163.359 34.492,95 19.801,-95 -54.293,0 z m 73.051,-89.6095 60.543,0 -52.852,252.9685 -55.898,0 c -12.5,0 -23.121,-7.34 -27.813,-18.59 L 575.16,13.9805 l 68.711,0 13.668,37.7695 83.941,0 7.899,-37.7695 z M 578.551,96.5586 c 0.277,66.7614 -92.34,70.4294 -91.672,100.2694 0.191,9.07 8.82,18.711 27.73,21.211 9.411,1.211 35.231,2.152 64.532,-11.32 l 11.519,53.633 c -15.738,5.699 -36.051,11.207 -61.211,11.207 -64.679,0 -110.23,-34.411 -110.621,-83.629 -0.387,-36.45 32.5,-56.719 57.301,-68.828 C 501.641,106.68 510.199,98.75 510.078,87.6484 509.922,70.6992 489.77,63.1992 470.941,62.8906 438.051,62.3789 418.91,71.7891 403.672,78.8594 L 391.84,23.4297 C 407.109,16.3984 435.352,10.3086 464.609,10 c 68.75,0 113.75,33.9805 113.942,86.5586 M 307.5,266.949 201.48,13.9805 l -69.21,0 -52.1489,201.8785 c -3.1719,12.422 -5.9414,16.993 -15.5508,22.18 C 48.8281,246.602 22.8906,254.609 0,259.609 l 1.55859,7.34 111.33241,0 c 14.218,0 26.988,-9.449 30.199,-25.777 l 27.57,-146.4103 68.09,172.1873 68.75,0 z" style="fill:#fff;"/>
</g>
</g>
</svg>
</div>
<div class="card-back">
<div class="bal">Balance</div>
<div class="bal-value">
<span>$</span>1999
</div>
</div>
</div>
</div>
<div class="bottom">
<div class="graph">
<div class="line-curtain"></div>
<ul class="legend">
<li class="income">Income</li>
<li class="expend">Expend</li>
</ul>
<svg version="1.1" class="lines" xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink" x="0px" y="0px"
width="310px" height="192px" viewBox="0 0 310 192" enable-background="new 0 0 310 192" xml:space="preserve">
<linearGradient id="SVGID_1_" gradientUnits="userSpaceOnUse" x1="239.3809" y1="-134.2422" x2="552.5303" y2="-134.2422" gradientTransform="matrix(1 0 0 -1 -241 -17)">
<stop offset="0" class="income-start"/>
<stop offset="1" class="income-stop"/>
</linearGradient>
<path opacity="0.05" fill="none" stroke="url(#SVGID_1_)" stroke-width="4" stroke-miterlimit="10" d="M0,101
c0,0,38.93,53.66,58.961,52.861c25.196-1.006,45.2-64.665,69.793-70.234c23.995-5.435,40.719,50.762,65.246,52.706
c24.688,1.957,38.618-54.107,63.333-55.7C273.467,79.593,310,123,310,123"/>
<linearGradient id="SVGID_2_" gradientUnits="userSpaceOnUse" x1="239.3809" y1="-124.2422" x2="552.5303" y2="-124.2422" gradientTransform="matrix(1 0 0 -1 -241 -17)">
<stop offset="0" class="income-start"/>
<stop offset="1" class="income-stop"/>
</linearGradient>
<path fill="none" stroke="url(#SVGID_2_)" stroke-width="4" stroke-miterlimit="10" d="M0,91c0,0,38.93,53.66,58.961,52.861
c25.196-1.006,45.2-64.665,69.793-70.234c23.995-5.435,40.719,50.762,65.246,52.706c24.688,1.957,38.618-54.107,63.333-55.7
C273.467,69.593,310,113,310,113"/>
<linearGradient id="SVGID_3_" gradientUnits="userSpaceOnUse" x1="239.4648" y1="-129.4629" x2="552.5186" y2="-129.4629" gradientTransform="matrix(1 0 0 -1 -241 -17)">
<stop offset="0" class="expend-start"/>
<stop offset="1" class="expend-stop"/>
</linearGradient>
<path opacity="0.05" fill="none" stroke="url(#SVGID_3_)" stroke-width="4" stroke-miterlimit="10" d="M0,145
c0,0,26.667-31.923,48-32c20-0.072,38,29.333,66.527,25.447C154.431,133.012,158.004,85.597,183,81
c29-5.333,61.527,50.928,81.666,49.333C285.408,128.689,310,100,310,100"/>
<linearGradient id="SVGID_4_" gradientUnits="userSpaceOnUse" x1="239.4648" y1="-119.4629" x2="552.5186" y2="-119.4629" gradientTransform="matrix(1 0 0 -1 -241 -17)">
<stop offset="0" class="expend-start"/>
<stop offset="1" class="expend-stop"/>
</linearGradient>
<path fill="none" stroke="url(#SVGID_4_)" stroke-width="4" stroke-miterlimit="10" d="M0,135c0,0,26.667-31.923,48-32
c20-0.072,38,29.333,66.527,25.447C154.431,123.012,158.004,75.597,183,71c29-5.333,61.527,50.928,81.666,49.333
C285.408,118.689,310,90,310,90"/>
</svg>
</div>
<div class="drawer">
<ul>
<li>
<span>Mar. 3</span>
<span class="income">
<svg class="icon" viewBox="0 0 22 22">
<path fill="#148AFF" d="M3,6H21V18H3V6M12,9A3,3 0 0,1 15,12A3,3 0 0,1 12,15A3,3 0 0,1 9,12A3,3 0 0,1 12,9M7,8A2,2 0 0,1 5,10V14A2,2 0 0,1 7,16H17A2,2 0 0,1 19,14V10A2,2 0 0,1 17,8H7Z" />
</svg>Income
</span>
<span>Received $1000 in deposits</span>
</li>
<li>
<span>Mar. 2</span>
<span class="expend">
<svg class="icon" viewBox="0 0 22 22">
<path fill="#f44" d="M4,2H19L17,22H6L4,2M6.2,4L7.8,20H8.8L7.43,6.34C8.5,6 9.89,5.89 11,7C12.56,8.56 15.33,7.69 16.5,7.23L16.8,4H6.2Z" />
</svg>Expend
</span>
<span>Spending $19 on leisure</span>
</li>
<li>
<span></span>
<span class="expend">
<svg class="icon" viewBox="0 0 22 22">
<path fill="#FFA831" d="M15.5,21L14,8H16.23L15.1,3.46L16.84,3L18.09,8H22L20.5,21H15.5M5,11H10A3,3 0 0,1 13,14H2A3,3 0 0,1 5,11M13,18A3,3 0 0,1 10,21H5A3,3 0 0,1 2,18H13M3,15H8L9.5,16.5L11,15H12A1,1 0 0,1 13,16A1,1 0 0,1 12,17H3A1,1 0 0,1 2,16A1,1 0 0,1 3,15Z" />
</svg>Expend
</span>
<span>Spending $20 on the dinner</span>
</li>
<li>
<span>Feb. 19</span>
<span class="expend">
<svg class="icon" viewBox="0 0 22 22">
<path fill="#CA9DF8" d="M16,21H8A1,1 0 0,1 7,20V12.07L5.7,13.12C5.31,13.5 4.68,13.5 4.29,13.12L1.46,10.29C1.07,9.9 1.07,9.27 1.46,8.88L7.34,3H9C9,4.1 10.34,5 12,5C13.66,5 15,4.1 15,3H16.66L22.54,8.88C22.93,9.27 22.93,9.9 22.54,10.29L19.71,13.12C19.32,13.5 18.69,13.5 18.3,13.12L17,12.07V20A1,1 0 0,1 16,21M20.42,9.58L16.11,5.28C15.8,5.63 15.43,5.94 15,6.2C14.16,6.7 13.13,7 12,7C10.3,7 8.79,6.32 7.89,5.28L3.58,9.58L5,11L8,9H9V19H15V9H16L19,11L20.42,9.58Z" />
</svg>Expend
</span>
<span>Spending $46 on clothes</span>
</li>
</ul>
</div>
</div>
</div>
// line graph and bullet colors
$incomeColor1: rgb(20, 138, 255);
$incomeColor2: rgb(0, 218, 255);
$expendColor1: rgb(255, 36, 115);
$expendColor2: rgb(253, 41, 239);
// card and drawer starting positions
$cardPos: 76px;
$drawerPos: -370px;
$animDur: 9s;
body {
background: rgb(189, 191, 255);
font-family: "Poppins", sans-serif;
margin: 0;
}
.link-box {
background: #fff;
padding: 5px 10px;
position: fixed;
bottom: 0;
left: 0;
}
.container {
background: #fff;
border-radius: 10px;
margin: 40px auto;
width: 310px;
height: 520px;
perspective: 600px;
-webkit-perspective: 600px;
// for tan and blue bars on the sides
&:before, &:after {
content: "";
position: absolute;
top: 96px;
width: 20px;
height: 110px;
animation: fadeTop $animDur linear infinite;
}
&:before {
background: rgb(231, 215, 199);
border-radius: 0 5px 5px 0;
left: 0;
}
&:after {
background: linear-gradient(rgb(165, 215, 255), rgb(155, 183, 255));
border-radius: 5px 0 0 5px;
right: 0;
}
}
/* Interface is split into top and bottom sections so that an 'overflow: hidden;' used to keep the drawer hidden doesn’t cause the card’s perspective to be lost. */
.top {
height: 150px;
transform-style: preserve-3d;
}
.bottom {
border-radius: 0 0 10px 10px;
height: 370px;
overflow: hidden;
position: relative;
z-index: 2;
}
.hamburger {
position: absolute;
top: 30px;
left: 20px;
width: 22px;
height: 16px;
animation: fadeTop $animDur linear infinite;
span {
background: rgb(202, 157, 248);
display: block;
margin-bottom: 5px;
height: 2px;
&:nth-of-type(2) {
width: 50%;
}
&:nth-of-type(3) {
width: 80%;
}
}
}
.card {
background: linear-gradient(rgb(255, 89, 150), rgb(255, 73, 117));
border-radius: 5px;
box-shadow: 8px 8px 8px rgba(255, 89, 150, 0.2), -8px 8px 8px rgba(255, 89, 150, 0.2);
color: #fff;
margin: auto;
overflow: hidden;
width: 230px;
height: 150px;
transform: translateY(76px);
transform-style: preserve-3d;
animation: flipCard $animDur ease-out infinite;
}
.card-front, .card-back {
height: 150px;
width: 230px;
position: absolute;
}
.card-front {
animation: hideFront $animDur linear infinite;
}
.card-back {
opacity: 0;
text-align: center;
transform: rotate(180deg) scale(-1,1);
animation: showBack $animDur linear infinite;
z-index: 1;
}
.number {
font-size: 14pt;
line-height: 116px;
text-align: center;
word-spacing: -7px;
}
.due-date {
font-family: Helvetica, sans-serif;
font-size: 10pt;
font-weight: 300;
float: left;
margin: 0 0 0 20px;
opacity: 0.5;
text-transform: uppercase;
word-spacing: 7px;
}
.visa {
float: right;
opacity: 0.3;
}
.bal {
font-weight: 300;
padding: 20px 0 5px 0;
opacity: 0.5;
}
.bal-value {
font-size: 24pt;
letter-spacing: 1px;
span {
font-size: 12pt;
}
}
.legend {
color: #aaa;
font-size: 10pt;
font-weight: 300;
position: absolute;
top: 145px;
left: 72px;
text-transform: uppercase;
margin: 0;
padding: 0;
animation: fadeLegend $animDur ease-out infinite;
li {
display: inline;
margin-right: 20px;
&:before {
border-radius: 50%;
content: "";
display: inline-block;
margin-right: 10px;
width: 10px;
height: 10px;
}
}
}
.lines, .line-curtain {
position: absolute;
right: 0;
bottom: 10px;
}
.line-curtain {
background: #fff;
height: 192px;
width: 100%;
z-index: 1;
animation: lines $animDur cubic-bezier(0,0,.26,.98) infinite;
}
.drawer {
background: #fff linear-gradient(rgba(202, 157, 248, 0.3), transparent 15px);
font-size: 10pt;
position: absolute;
bottom: 0px;
width: 100%;
height: 370px;
z-index: 2;
animation: pullOut $animDur cubic-bezier(0,1,0.6,1) infinite;
// thick line in center
&:before {
background: rgb(206, 189, 226);
border-radius: 12px;
display: block;
content: "";
position: absolute;
top: 10px;
left: 50%;
width: 24px;
height: 4px;
margin-left: -12px;
}
ul {
padding: 0;
}
li {
background: linear-gradient(90deg, transparent 71px, rgb(237, 223, 251) 71px, rgb(237, 223, 251) 72px, transparent 72px);
display: block;
padding: 10px 0 20px 0;
width: 100%;
height: auto;
animation: slideIn $animDur cubic-bezier(0,1,0.6,1) infinite;
&:first-of-type {
padding-top: 25px;
}
@for $i from 2 through 4 {
&:nth-of-type(#{$i}) {
animation-delay: 0s + ($i / 25);
}
}
}
span {
color: rgb(206, 189, 226);
display: inline-block;
position: relative;
font-weight: 300;
line-height: 25px;
text-indent: 10px;
&:nth-of-type(1) {
width: 72px;
}
&:nth-of-type(2) {
color: rgb(90, 52, 132);
font-weight: bold;
&:before {
border: 10px solid #fff;
border-radius: 50%;
content: "";
display: inline-block;
position: absolute;
top: -3px;
left: -20px;
width: 10px;
height: 10px;
}
}
&:nth-of-type(3) {
text-indent: 116px;
}
}
}
/* Income bullet */
.income:before {
background: linear-gradient(90deg, $incomeColor1, $incomeColor2);
}
/* Income line gradient */
.income-start {
stop-color: $incomeColor1;
}
.income-stop {
stop-color: $incomeColor2;
}
/* Expend bullet */
.expend:before {
background: linear-gradient(90deg, $expendColor1, $expendColor2);
}
/* Expend line gradient */
.expend-start {
stop-color: $expendColor1;
}
.expend-stop {
stop-color: $expendColor2;
}
.icon {
display: inline-block;
margin-right: 8px;
width: 22px;
height: 22px;
vertical-align: top;
}
/* Animations */
@keyframes lines {
0% {width: 100%;}
11.11% {width: 100%;}
21.11% {width: 0%;}
73.33% {width: 0%;}
73.34% {width: 100%;}
100% {width: 100%;}
}
@keyframes flipCard {
0% {
box-shadow: 8px 8px 8px rgba(255, 89, 150, 0.2), -8px 8px 8px rgba(255, 89, 150, 0.2);
transform: translateY($cardPos) rotateX(0deg);
}
40% {
box-shadow: 8px 8px 8px rgba(255, 89, 150, 0.2), -8px 8px 8px rgba(255, 89, 150, 0.2);
transform: translateY($cardPos) rotateX(0deg);
}
43.33% {
box-shadow: 8px -8px 8px rgba(255, 89, 150, 0.2), -8px -8px 8px rgba(255, 89, 150, 0.2);
transform: translateY($cardPos) rotateX(185deg);
}
44.44% {transform: translateY($cardPos) rotateX(177deg);}
46.66% {transform: translateY($cardPos) rotateX(180deg);}
52.22% {transform: translateY($cardPos) rotateX(180deg);}
56.66% {transform: translateY($cardPos - 40) rotateX(180deg);}
85.55% {transform: translateY($cardPos - 40) rotateX(180deg);}
87.77% {
box-shadow: 8px -8px 8px rgba(255, 89, 150, 0.2), -8px -8px 8px rgba(255, 89, 150, 0.2);
transform: translateY($cardPos) rotateX(180deg);
}
91.11% {
box-shadow: 8px 8px 8px rgba(255, 89, 150, 0.2), -8px 8px 8px rgba(255, 89, 150, 0.2);
transform: translateY($cardPos) rotateX(-5deg);
}
94.44% {transform: translateY($cardPos) rotateX(3deg);}
100% {transform: translateY($cardPos) rotateX(0deg);}
}
@keyframes hideFront {
0% {opacity: 1;}
41.16% {opacity: 1;}
41.17% {opacity: 0;}
89.55% {opacity: 0;}
89.56% {opacity: 1;}
100% {opacity: 1;}
}
@keyframes showBack {
0% {opacity: 0;}
41.16% {opacity: 0;}
41.17% {opacity: 1;}
89.55% {opacity: 1;}
89.56% {opacity: 0;}
100% {opacity: 0;}
}
@keyframes fadeTop {
0% {opacity: 1;}
45.55% {opacity: 1;}
50% {opacity: 0;}
96.66% {opacity: 0;}
100% {opacity: 1;}
}
@keyframes fadeLegend {
0% {opacity: 0;}
5.55% {opacity: 1;}
66.66% {opacity: 1;}
70% {opacity: 0;}
100% {opacity: 0;}
}
@keyframes slideIn {
0% {transform: translateY(-$drawerPos);}
53.33% {transform: translateY(-$drawerPos);}
56.66% {transform: translateY(0px);}
100% {transform: translateY(0px);}
}
@keyframes pullOut {
0% {bottom: $drawerPos;}
51.11% {bottom: $drawerPos;}
58.88% {bottom: 0;}
86.66% {bottom: 0;}
93.33% {bottom: $drawerPos;}
100% {bottom: $drawerPos;}
}
// Original version: https://dribbble.com/shots/2833787-Payment-Ux
// VISA logo from Wikimedia Commons (https://commons.wikimedia.org/wiki/File:Visa_Inc._logo.svg)
// SVG icons in drawer from https://materialdesignicons.com/
Also see: Tab Triggers