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.
<div class="container">
<div class="bar">
<div class="bold"><h3>Bold</h3></div>
<div class="circle top"></div>
<div class="circle middle"></div>
<div class="circle bottom"></div>
<div class="creamy"><h3>Creamy</h3></div>
</div>
<div class="coffee-cups">
<div class="cup-small doppio">
<div class="handle"></div>
</div>
<div class="cup americano">
<div class="handle"></div>
</div>
<div class="cup-small macchiato">
<div class="handle"></div>
</div>
<div class="cup-small flatwhite">
<div class="handle"></div>
</div>
<div class="cup cappuccino">
<div class="handle"></div>
</div>
<div class="cup-long latte">
<div class="handle"></div>
<div class="bottom-handle"></div>
</div>
</div>
<div class="info">
<div class="first">
<h1>doppio</h1>
<p>Double shot of espresso. Straight.</p>
</div>
<div class="second">
<h1>americano</h1>
<p>Shots of espresso diluted with water</p>
</div>
<div class="third">
<h1>Macchiato</h1>
<p>Espresso with a dash of frothy foamed milk.</p>
</div>
<div class="fourth">
<h1>Flat White</h1>
<p>Double shot of espresso with steamed milk.</p>
</div>
<div class="fifth">
<h1>Cappuccino</h1>
<p>Double shot of espresso topped with an airy thick layer of foamed milk.</p>
</div>
<div class="sixth">
<h1>Caffe Latte</h1>
<p>A shot of espresso in steamed milk lightly topped with foam.</p>
</div>
</div>
</div>
<div class="key">
<div class="circle espresso"><p class="small">espresso</p></div>
<div class="circle milk"><p class="small">steamed milk</p></div>
<div class="circle foam"><p class="small">milk foam</p></div>
<div class="circle water"><p class="small">water</p></div>
</div>
<footer>
<p>made by <a href="https://codepen.io/juliepark"> julie</a> ♡
</footer>
@import url('https://fonts.googleapis.com/css?family=Lato|Lora');
$dark: #252C32;
$brown: #5B4644;
$coffee: #87624F;
$tan: #DAB7A3;
$white: #F4E8DA;
$water: #859FB5;
$sans: 'Lato', sans-serif;
$serif: 'Lora', serif;
html {
display: grid;
min-height: 100%;
}
body {
background: $dark;
display: grid;
font-family: $sans;
text-transform: uppercase;
}
h3 {
font-size: 0.8em;
letter-spacing: 1px;
font-weight: 100;
}
.container {
position: relative;
margin: auto;
overflow: hidden;
width: 500px;
height: 700px;
}
.bar {
position: absolute;
height: 85%;
width: 2px;
left: 7%;
top: 7.5%;
background: $white;
}
.circle {
width: 10px;
height: 10px;
position: absolute;
border-radius: 50%;
left: -5px;
border: 1px solid $white;
box-shadow: 0px 0px 7px rgba($white, 100%);
}
.top {
background: $brown;
top: -1%;
}
.middle {
background: $coffee;
top: 38%;
}
.bottom {
background: $tan;
bottom: -1%;
}
.bold {
color: $coffee;
position: absolute;
top: -7%;
left: -17px;
}
.creamy {
color: $tan;
position: absolute;
bottom: -7%;
left: -27px;
}
.info {
width: 55%;
height: 100%;
position: absolute;
left: 43%;
}
//coffee cup drawings
.coffee-cups {
width: 40%;
height: 100%;
position: absolute;
left: 10%;
top: 3%;
}
.handle {
position: absolute;
height: 20px;
width: 15px;
background: transparent;
border-radius: 50% 30%;
left: 95%;
top: 10%;
z-index: -1;
border: 2px solid $white;
}
.cup {
position: absolute;
width: 70px;
height: 55px;
background: $dark;
border: 2px solid $white;
border-radius: 0 0 5rem 5rem;
left: 20%;
}
.cup-small {
position: absolute;
width: 55px;
height: 40px;
background: $dark;
border: 2px solid $white;
border-radius: 0 0 5rem 5rem;
left: 23%;
}
.cup-long {
position: absolute;
width: 60px;
height: 70px;
background: $dark;
border: 2px solid $white;
border-radius: 10% 10% 50% 50%;
left: 22%;
}
.doppio {
top: 5%;
background: linear-gradient(to bottom, $dark 40%, $brown 40%, $coffee 70%);
}
.americano {
top: 18.5%;
background: linear-gradient(to bottom, $dark 13%, $water 13%, $water 50%, $coffee 50%);
}
.macchiato {
top: 35%;
background: linear-gradient(to bottom, $dark 20%, $white 20%, $white 40%, $coffee 40%);
}
.flatwhite {
top: 50%;
background: linear-gradient(to bottom, $dark 10%, $white 10%, $tan 60%, $coffee 65%, $brown 90%);
}
.cappuccino {
top: 64%;
background: linear-gradient(to bottom, $white 50%, $tan 50%, $tan 55%, $coffee 60%);
}
.latte {
top: 81%;
background: linear-gradient(to bottom, $dark 5%, $white 5%, $white 30%, $tan 30%, $tan 70%, $coffee 70%);
}
//description
h1 {
color: $white;
font-size: 1em;
letter-spacing: 3px;
}
p {
color: $white;
font-family: $serif;
text-transform: none;
font-size: 0.7em;
letter-spacing: 0.5px;
margin-top: -5px;
}
.first, .second, .third, .fourth, .fifth, .sixth {
position: absolute;
}
.first {
top: 7%;
}
.second {
top: 21%;
}
.third {
top: 36%;
}
.fourth {
top: 52%;
}
.fifth {
top: 65%;
}
.sixth {
top: 83%;
}
// key for the colors
.small {
margin-left: 20px;
margin-top: -1px;
font-family: $sans;
text-transform: uppercase;
letter-spacing: 2px;
}
.key {
position: relative;
margin: auto;
width: 500px;
height: 200px;
}
.espresso {
background: $brown;
position: absolute;
left: 17%;
}
.milk {
background: $tan;
position: absolute;
left: 40%;
}
.foam {
background: $white;
position: absolute;
left: 63%;
}
.water {
background: $water;
position: absolute;
left: 83%;
}
footer {
position: absolute;
bottom: 0;
right: 0;
text-align: center;
font-size: 1em;
text-transform: uppercase;
padding: 10px;
color: #EA7996;
p {
text-transform: uppercase;
color: $tan;
font-family: $sans;
letter-spacing: 3px;
}
a {
font-family: $sans;
text-transform: uppercase;
color: #ffffff;
text-decoration: none;
&:hover {
color: $water;
}
}
}
Also see: Tab Triggers