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.
<header>
<div class="container">
<div class="navigation">
<div class="logo">
<i class="icon icon-basket"></i>shop42</div>
<div class="secure">
<i class="icon icon-shield"></i>
<span>Secure Checkout</span>
</div>
</div>
<div class="notification">
Complete Your Purchase
</div>
</div>
</header>
<section class="content">
<div class="container">
</div>
<div class="details shadow">
<div class="details__item">
<div class="item__image">
<img class="iphone" src="https://www.apple.com/v/iphone/compare/k/images/overview/compare_iphoneXSmax_silver_large.jpg" alt="">
</div>
<div class="item__details">
<div class="item__title">
Iphone X
</div>
<div class="item__price">
649,99 £
</div>
<div class="item__quantity">
Quantity: 1
</div>
<div class="item__description">
<ul style="">
<li>Super fast and power efficient</li>
<li>A lot of fast memory</li>
<li>High resolution camera</li>
<li>Smart tools for health and traveling and more</li>
<li>Share your games and achievements with your friends via Group Play</li>
</ul>
</div>
</div>
</div>
</div>
<div class="discount"></div>
<div class="container">
<div class="payment">
<div class="payment__title">
Payment Method
</div>
<div class="payment__types">
<div class="payment__type payment__type--cc active">
<i class="icon icon-credit-card"></i>Credit Card</div>
<div class="payment__type payment__type--paypal">
<i class="icon icon-paypal"></i>Paypal</div>
<div class="payment__type payment__type--paypal">
<i class="icon icon-wallet"></i>SEPA</div>
<div class="payment__type payment__type--paypal">
<i class="icon icon-note"></i>Invoice</div>
</div>
<div class="payment__info">
<div class="payment__cc">
<div class="payment__title">
<i class="icon icon-user"></i>Personal Information
</div>
<form>
<div class="form__cc">
<div class="row">
<div class="field">
<div class="title">Credit Card Number
</div>
<input type="text" class="input txt text-validated" value="4542 9931 9292 2293" />
</div>
</div>
<div class="row">
<div class="field small">
<div class="title">Expiry Date
</div>
<select class="input ddl">
<option selected>01</option>
<option>02</option>
<option>03</option>
<option>04</option>
<option>05</option>
<option>06</option>
<option>07</option>
<option>08</option>
<option>09</option>
<option>10</option>
<option>11</option>
<option>12</option>
</select>
<select class="input ddl">
<option>01</option>
<option>02</option>
<option>03</option>
<option>04</option>
<option>05</option>
<option>06</option>
<option>07</option>
<option>08</option>
<option>09</option>
<option>10</option>
<option>11</option>
<option>12</option>
<option>13</option>
<option>14</option>
<option>15</option>
<option selected>16</option>
<option>17</option>
<option>18</option>
<option>19</option>
<option>20</option>
<option>21</option>
<option>22</option>
<option>23</option>
<option>24</option>
<option>25</option>
<option>26</option>
<option>27</option>
<option>28</option>
<option>29</option>
<option>30</option>
<option>31</option>
</select>
</div>
<div class="field small">
<div class="title">CVV Code
<span class="numberCircle">?</span>
</div>
<input type="text" class="input txt" />
</div>
</div>
<div class="row">
<div class="field">
<div class="title">Name on Card
</div>
<input type="text" class="input txt" />
</div>
</div>
</div>
</form>
</div>
<div class="payment__shipping">
<div class="payment__title">
<i class="icon icon-plane"></i> Shiping Information
</div>
<div class="details__user">
<div class="user__name">John Doe
<br> 13/03/1980</div>
<div class="user__address">Shipping Address: 22 Street, Address
<br>Country</div>
</div>
</div>
</div>
</div>
</div>
<div class="container">
<div class="actions">
<a href="#" class="btn action__submit">Place your Order
<i class="icon icon-arrow-right-circle"></i>
</a>
<a href="#" class="backBtn">Go Back to Shop</a>
</div>
</section>
</div>
*,
*:after,
*:before {
box-sizing: border-box;
}
ul {
padding-left: 10px;
}
body {
font-family: "Josefin Sans", sans-serif;
color: #0a0a0a;
line-height: 1.4;
}
a {
color: #000;
}
.content {
z-index: 9999;
}
.secure,
.backBtn {
display: flex;
}
.secure span,
.backBtn span {
margin-left: 5px;
}
.backBtn {
margin-top: 20px;
}
.secure {
color: #afb5c0;
align-items: flex-end;
}
.secure .icon {
font-size: 20px;
line-height: 20px;
}
.logo {
font-size: 20px;
font-weight: bold;
display: flex;
justify-content: center;
align-items: flex-end;
}
.logo .icon {
font-size: 32px;
line-height: 32px;
margin-right: 5px;
}
img {
width: 100%;
border-radius: 8px 0 0 8px;
}
.details {
max-width: 800px;
min-height: 300px;
margin-left: auto;
margin-right: auto;
margin-top: -200px;
background: #fff;
border-radius: 8px;
display: flex;
flex-direction: column;
position: relative;
}
.details__item {
display: flex;
}
.details__user {
background: #f6f9fc;
padding: 20px;
border-radius: 8px;
border: 1px solid #dadada;
}
.item__quantity {
position: absolute;
right: 50px;
top: 30px;
font-size: 20px;
}
.item__image {
display: flex;
align-items: center;
justify-content: center;
}
.item__image .iphone {
margin-top: -50px;
margin-left: -100px;
width: 200px;
}
.item__details {
padding: 30px;
}
.item__title {
font-size: 28px;
font-weight: 600;
}
.item__price {
font-size: 22px;
color: #bec3cb;
}
.icon {
font-size: 16px;
vertical-align: middle;
}
header {
background-color: #f6f9fc;
min-height: 500px;
background-image: url("../images/pattern.png");
}
.navigation {
display: flex;
align-items: center;
justify-content: space-between;
padding: 50px 0 80px 0;
color: #246eea;
font-size: 14px;
text-transform: uppercase;
letter-spacing: 1px;
font-weight: 700;
}
.container {
width: 960px;
margin: 0 auto;
}
.shadow {
box-shadow: 0 15px 35px rgba(50, 50, 93, 0.1), 0 5px 15px rgba(0, 0, 0, 0.07);
}
.row {
display: flex;
}
.txt {
border-color: #e1e8ee;
width: 100%;
}
.input {
border-radius: 5px;
border-style: solid;
border-width: 2px;
height: 48px;
padding-left: 15px;
font-weight: 600;
font-size: 14px;
color: #5e6977;
}
input[type="text"] {
display: initial;
padding: 15px;
}
.text-validated {
border-color: #7dc855;
background-image: url("../images/icon-tick.png");
background-repeat: no-repeat;
background-position: right 18px center;
}
.ddl {
border-color: #f0f4f7;
background-color: #f0f4f7;
width: 100px;
margin-right: 10px;
}
.title {
font-size: 14px;
padding-bottom: 8px;
}
.field {
padding-top: 15px;
padding-right: 30px;
width: 50%;
}
.field.small {
width: auto;
}
.notification {
text-align: center;
font-size: 28px;
font-weight: 600;
display: flex;
justify-content: center;
}
.notification .icon {
font-size: 28px;
color: #7dc855;
line-height: 28px;
margin-right: 10px;
}
.actions {
display: flex;
align-items: center;
justify-content: center;
flex-direction: column;
padding: 60px 0 40px 0;
}
.payment {
padding: 20px 0 0 0;
}
.payment__title {
margin: 40px 0 20px 0;
font-size: 18px;
display: flex;
text-align: left;
}
.payment__title .icon {
margin-right: 10px;
}
.btn {
font-family: "Josefin Sans", sans-serif;
border-radius: 8px;
border: 0;
letter-spacing: 1px;
color: #fff;
background: #246eea;
padding: 20px 60px;
white-space: nowrap;
font-size: 16px;
line-height: 1;
text-transform: uppercase;
transition: all 0.15s ease;
text-decoration: none;
}
.btn .icon {
margin-left: 10px;
font-size: 20px;
}
.btn:hover {
-webkit-transform: translateY(-1px);
transform: translateY(-1px);
background: #4984ea;
}
.btn.action__back {
background: transparent;
color: #a0a0a0;
}
.payment__types {
display: flex;
justify-content: center;
align-items: center;
}
.payment__info {
display: flex;
}
.payment__cc {
flex: 60%;
}
.payment__shipping {
flex: 40%;
}
.shipping__info {
background: #f6f9fc;
padding: 10px;
border-radius: 8px;
}
.payment__type {
display: flex;
border: 2px solid #d9d9d9;
border-radius: 8px;
padding: 20px 40px;
width: 100%;
justify-content: center;
align-items: center;
cursor: pointer;
color: #d9d9d9;
transition: all 0.15s ease;
}
.payment__type:hover {
-webkit-transform: translateY(-1px);
transform: translateY(-1px);
}
.payment__type.active {
color: #0a0a0a;
background: #f6fcf7;
border-color: #7dc855;
}
.payment__type .icon {
font-size: 32px;
margin-right: 10px;
}
.payment__type + .payment__type {
margin-left: 10px;
}
.icon-xl {
font-size: 48px;
line-height: 48px;
}
.content {
display: block;
}
.thankyou {
display: block;
}
.thankyou .details {
opacity: 1;
justify-content: center;
align-items: center;
}
.thankyou .details h3 {
font-weight: 600;
}
.thankyou .details__item {
display: flex;
flex-direction: column;
justify-content: center;
align-items: center;
}
.thankyou .details__item .icon-xl {
font-size: 32px;
color: #7dc855;
line-height: 32px;
}
.loading {
position: relative;
}
.loading:after {
-webkit-animation: spinAround .5s infinite linear;
animation: spinAround .5s infinite linear;
border: 4px solid #7dc855;
border-radius: 290486px;
border-right-color: transparent;
border-top-color: transparent;
content: "";
height: 5em;
width: 5em;
position: absolute;
}
.loading .details__item {
opacity: 0;
}
@-webkit-keyframes spinAround {
from {
-webkit-transform: rotate(0);
transform: rotate(0);
}
to {
-webkit-transform: rotate(359deg);
transform: rotate(359deg);
}
}
@keyframes spinAround {
from {
-webkit-transform: rotate(0);
transform: rotate(0);
}
to {
-webkit-transform: rotate(359deg);
transform: rotate(359deg);
}
}
Also see: Tab Triggers