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.
<!-- INSPO: https://www.behance.net/gallery/69583099/Mobile-Flights-App-Concept -->
<main class="ticket-system">
<div class="top">
<h1 class="title">Wait a second, your ticket is being printed</h1>
<div class="printer" />
</div>
<div class="receipts-wrapper">
<div class="receipts">
<div class="receipt">
<svg class="airliner-logo" viewBox="0 0 403 94" xmlns="http://www.w3.org/2000/svg" xmlns:serif="http://www.serif.com/" fill-rule="evenodd" clip-rule="evenodd" stroke-linejoin="round" stroke-miterlimit="1.414">
<path d="M402.772 59.544c0-13.172-9.632-16.649-21.203-20.114-5.601-1.644-10.58-3.115-10.58-7.98 0-4.271 4.319-5.691 7.571-5.691 2.738 0 7.917.578 8.342 6.918h14.702c-.252-12.098-10.128-17.364-22.78-17.364-7.835 0-14.34 2.226-18.431 6.246-2.835 2.808-4.578 6.922-4.578 11.209 0 11.122 7.418 15.579 15.823 18.123 9.431 2.879 15.669 4.606 15.669 9.801 0 3.462-2.741 6.927-8.161 6.927-6.914 0-9.415-4.118-9.581-8.165h-14.843c0 13.757 11.587 18.803 24.424 18.803 16.37 0 23.626-9.321 23.626-18.713m-53.36 0c0-13.172-9.584-16.649-21.171-20.114-5.585-1.644-10.6-3.115-10.6-7.98 0-4.271 4.338-5.691 7.587-5.691 2.757 0 7.913.578 8.326 6.918h14.675c-.244-12.098-10.073-17.364-22.749-17.364-7.839 0-14.348 2.226-18.415 6.246-2.831 2.808-4.582 6.922-4.582 11.209 0 11.122 7.418 15.579 15.835 18.123 9.415 2.879 15.673 4.606 15.673 9.801 0 3.462-2.745 6.927-8.169 6.927-6.922 0-9.431-4.118-9.581-8.165h-14.835c0 13.757 11.586 18.803 24.416 18.803 16.326 0 23.59-9.321 23.59-18.713m-166.379 0c0-11.453-6.077-15.288-19.366-19.622-6.266-2.037-12.106-3.607-12.106-8.472 0-4.271 4.338-5.691 7.587-5.691 2.749 0 7.929.578 8.349 6.918h14.659c-.252-12.098-10.088-17.364-22.749-17.364-7.846 0-14.328 2.226-18.418 6.246-2.844 2.808-4.578 6.922-4.578 11.209 0 11.122 7.425 15.579 15.814 18.123 9.44 2.879 15.678 4.606 15.678 9.801 0 3.462-2.75 6.927-8.181 6.927-6.891 0-9.404-4.118-9.561-8.165h-14.844c0 13.757 11.603 18.803 24.405 18.803 16.349 0 23.311-9.321 23.311-18.713m74.787-42.843l-9.978 40.035-11.689-40.035h-14.981l-11.681 40.035-10.006-40.035h-15.162l16.491 59.739h16.02l11.822-40.966 11.827 40.966h16l16.542-59.739H257.82zm36.723 59.739h-15.516V16.701h15.516V76.44zM102.141 93.347H0L74.861 0h50.276l-22.996 93.347z" fill="#dc2f34"/>
<path d="M86.514 38.058V17.96H69.291v20.098H49.193v17.223h20.079v20.106h17.23V55.281h20.11V38.058H86.514z" fill="#fff"/>
</svg>
<div class="route">
<h2>NYC</h2>
<svg class="plane-icon" xmlns="http://www.w3.org/2000/svg" viewBox="0 0 510 510">
<path fill="#3f32e5" d="M497.25 357v-51l-204-127.5V38.25C293.25 17.85 275.4 0 255 0s-38.25 17.85-38.25 38.25V178.5L12.75 306v51l204-63.75V433.5l-51 38.25V510L255 484.5l89.25 25.5v-38.25l-51-38.25V293.25l204 63.75z"/>
</svg>
<h2>ATL</h2>
</div>
<div class="details">
<div class="item">
<span>Passanger</span>
<h3>69Pixels</h3>
</div>
<div class="item">
<span>Flight No.</span>
<h3>US6969</h3>
</div>
<div class="item">
<span>Departure</span>
<h3>08/26/2018 15:33</h3>
</div>
<div class="item">
<span>Gate Closes</span>
<h3>15:03</h3>
</div>
<div class="item">
<span>Luggage</span>
<h3>Hand Luggage</h3>
</div>
<div class="item">
<span>Seat</span>
<h3>69P</h3>
</div>
</div>
</div>
<div class="receipt qr-code">
<svg class="qr" xmlns="http://www.w3.org/2000/svg" viewBox="0 0 29.938 29.938">
<path d="M7.129 15.683h1.427v1.427h1.426v1.426H2.853V17.11h1.426v-2.853h2.853v1.426h-.003zm18.535 12.83h1.424v-1.426h-1.424v1.426zM8.555 15.683h1.426v-1.426H8.555v1.426zm19.957 12.83h1.427v-1.426h-1.427v1.426zm-17.104 1.425h2.85v-1.426h-2.85v1.426zm12.829 0v-1.426H22.81v1.426h1.427zm-5.702 0h1.426v-2.852h-1.426v2.852zM7.129 11.406v1.426h4.277v-1.426H7.129zm-1.424 1.425v-1.426H2.852v2.852h1.426v-1.426h1.427zm4.276-2.852H.002V.001h9.979v9.978zM8.555 1.427H1.426v7.127h7.129V1.427zm-5.703 25.66h4.276V22.81H2.852v4.277zm14.256-1.427v1.427h1.428V25.66h-1.428zM7.129 2.853H2.853v4.275h4.276V2.853zM29.938.001V9.98h-9.979V.001h9.979zm-1.426 1.426h-7.127v7.127h7.127V1.427zM0 19.957h9.98v9.979H0v-9.979zm1.427 8.556h7.129v-7.129H1.427v7.129zm0-17.107H0v7.129h1.427v-7.129zm18.532 7.127v1.424h1.426v-1.424h-1.426zm-4.277 5.703V22.81h-1.425v1.427h-2.85v2.853h2.85v1.426h1.425v-2.853h1.427v-1.426h-1.427v-.001zM11.408 5.704h2.85V4.276h-2.85v1.428zm11.403 11.405h2.854v1.426h1.425v-4.276h-1.425v-2.853h-1.428v4.277h-4.274v1.427h1.426v1.426h1.426V17.11h-.004zm1.426 4.275H22.81v-1.427h-1.426v2.853h-4.276v1.427h2.854v2.853h1.426v1.426h1.426v-2.853h5.701v-1.426h-4.276v-2.853h-.002zm0 0h1.428v-2.851h-1.428v2.851zm-11.405 0v-1.427h1.424v-1.424h1.425v-1.426h1.427v-2.853h4.276v-2.853h-1.426v1.426h-1.426V7.125h-1.426V4.272h1.426V0h-1.426v2.852H15.68V0h-4.276v2.852h1.426V1.426h1.424v2.85h1.426v4.277h1.426v1.426H15.68v2.852h-1.426V9.979H12.83V8.554h-1.426v2.852h1.426v1.426h-1.426v4.278h1.426v-2.853h1.424v2.853H12.83v1.426h-1.426v4.274h2.85v-1.426h-1.422zm15.68 1.426v-1.426h-2.85v1.426h2.85zM27.086 2.853h-4.275v4.275h4.275V2.853zM15.682 21.384h2.854v-1.427h-1.428v-1.424h-1.427v2.851zm2.853-2.851v-1.426h-1.428v1.426h1.428zm8.551-5.702h2.853v-1.426h-2.853v1.426zm1.426 11.405h1.427V22.81h-1.427v1.426zm0-8.553h1.427v-1.426h-1.427v1.426zm-12.83-7.129h-1.425V9.98h1.425V8.554z"/>
</svg>
<div class="description">
<h2>69Pixels</h2>
<p>Show QR-code when requested</p>
</div>
</div>
</div>
</div>
</main>
* {
box-sizing: border-box;
}
html, body {
height: 100%;
margin: 0;
}
body {
@import url('https://fonts.googleapis.com/css?family=Ubuntu:300,400,500,700');
font-family: 'Ubuntu', sans-serif;
background-color: #3f32e5;
height: 100%;
-webkit-font-smoothing: antialiased;
-moz-osx-font-smoothing: grayscale;
text-align: center;
color: #1c1c1c;
display: flex;
justify-content: center;
}
.ticket-system {
max-width: 385px;
.top {
display: flex;
align-items: center;
flex-direction: column;
.title {
font-weight: normal;
font-size: 1.6em;
text-align: left;
margin-left: 20px;
margin-bottom: 50px;
color: #fff;
}
.printer {
width: 90%;
height: 20px;
border: 5px solid #fff;
border-radius: 10px;
box-shadow: 1px 3px 3px 0px rgba(0, 0, 0, 0.2);
}
}
.receipts-wrapper {
overflow: hidden;
margin-top: -10px;
padding-bottom: 10px;
}
.receipts {
width: 100%;
display: flex;
align-items: center;
flex-direction: column;
transform: translateY(-510px);
animation-duration: 2.5s;
animation-delay: 500ms;
animation-name: print;
animation-fill-mode: forwards;
.receipt {
padding: 25px 30px;
text-align: left;
min-height: 200px;
width: 88%;
background-color: #fff;
border-radius: 10px 10px 20px 20px;
box-shadow: 1px 3px 8px 3px rgba(0, 0, 0, 0.2);
.airliner-logo {
max-width: 80px;
}
.route {
display: flex;
justify-content: space-between;
align-items: center;
margin: 30px 0;
.plane-icon {
width: 30px;
height: 30px;
transform: rotate(90deg);
}
h2 {
font-weight: 300;
font-size: 2.2em;
margin: 0;
}
}
.details {
display: flex;
justify-content: space-between;
flex-wrap: wrap;
.item {
display: flex;
flex-direction: column;
min-width: 70px;
span {
font-size: .8em;
color: rgba(28, 28, 28, .7);
font-weight: 500;
}
h3 {
margin-top: 10px;
margin-bottom: 25px;
}
}
}
&.qr-code {
height: 110px;
min-height: unset;
position: relative;
border-radius: 20px 20px 10px 10px;
display: flex;
align-items: center;
//TODO: replace with svg
&::before {
content: '';
background: linear-gradient(to right, #fff 50%, #3f32e5 50%);
background-size: 22px 4px, 100% 4px;
height: 4px;
width: 90%;
display: block;
left: 0;
right: 0;
top: -1px;
position: absolute;
margin: auto;
}
.qr {
width: 70px;
height: 70px;
}
.description {
margin-left: 20px;
h2 {
margin: 0 0 5px 0;
font-weight: 500;
}
p {
margin: 0;
font-weight: 400;
}
}
}
}
}
}
@keyframes print {
0% {
transform: translateY(-510px)
}
35% {
transform: translateY(-395px);
}
70% {
transform: translateY(-140px);
}
100% {
transform: translateY(0);
}
}
Also see: Tab Triggers