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="content">
<h1>The Cascade Cafe</h1>
<address>
<p>
<svg viewBox="0 -100 500 512" width="20" title="map-marker-alt">
<path d="M172.268 501.67C26.97 291.031 0 269.413 0 192 0 85.961 85.961 0 192 0s192 85.961 192 192c0 77.413-26.97 99.031-172.268 309.67-9.535 13.774-29.93 13.773-39.464 0zM192 272c44.183 0 80-35.817 80-80s-35.817-80-80-80-80 35.817-80 80 35.817 80 80 80z" transform="rotate(-20)" />
</svg>
123 Main Street · Smalltown, PA
</p>
<a href="4125550100">
<svg viewBox="-200 50 600 600" width="20" title="phone-alt">
<path d="M497.39 361.8l-112-48a24 24 0 0 0-28 6.9l-49.6 60.6A370.66 370.66 0 0 1 130.6 204.11l60.6-49.6a23.94 23.94 0 0 0 6.9-28l-48-112A24.16 24.16 0 0 0 122.6.61l-104 24A24 24 0 0 0 0 48c0 256.5 207.9 464 464 464a24 24 0 0 0 23.4-18.6l24-104a24.29 24.29 0 0 0-14.01-27.6z" transform="rotate(25)" />
</svg>
412-555-0100
</a>
</address>
<ul class="boxes">
<li class="box">
<h2>Coffee</h2>
<p class="prices"><span>Small<em>$2</em></span> <span>Large<em>$4</em></span></p>
<dl>
<dt>House Blend</dt>
<dd class="description">
<p>Smoky, strong, and assertive, just like us.</p>
</dd>
<dt>Organic French Roast</dt>
<dd class="description">
<p>Smooth and mellow with hints of molasses.</p>
</dd>
<dt>Organic Decaf</dt>
<dd class="description">
<p>Full bodied and rich, we promise you won't miss the caffiene.</p>
</dd>
</dl>
</li>
<li class="box">
<h2>Espresso Drinks</h2>
<p class="prices"><span>Small<em>$3</em></span> <span>Large<em>$5</em></span></p>
<dl>
<dt>Machiatto </dt>
<dd class="description">
<p>Espressso and steamed milk, served in a demitasse cup. <span class="note">(Size Small Only)</span></p>
</dd>
<dt>Latte</dt>
<dd class="description">
<p>Espresso with steamed milk, and sometimes a little art on top. </p>
</dd>
<dt>Mocha</dt>
<dd class="description">
<p>Espresso with steamed chocolate milk and whipped cream. Also available with white chocolate milk.</p>
</dd>
<dt>Americano</dt>
<dd class="description">
<p>1 shot espresso, two shots hot water.</p>
</dd>
</dl>
</li>
<li class="box">
<h2>Tea</h2>
<p class="tip">Served to brave people in our notorious antique tea cups.</p>
<p class="prices"><span>Per Cup<em>$2</em></span> <span class="note"><em>$200</em>if you break the cup</span></p>
<dl>
<dt>Earl Grey </dt>
<dd class="description">
<p>Black tea fragranced with bergamot.</p>
</dd>
<dt>Ginger Hibiscus</dt>
<dd class="description">
<p>Floral, tart, and spicy. Caffeine free.</p>
</dd>
<dt>Cascade Green</dt>
<dd class="description">
<p>A blend of green teas hand selected by our master teamaker.</p>
</dd>
<dt>Chamomile</dt>
<dd class="description">
<p>Soothing and slightly sweet. Try it with honey! Caffeine free.</p>
</dd>
</dl>
</li>
<li class="box">
<h2>From the Bakery</h2>
<p class="prices"><span>Cookies<em>$2</em></span> <span>Muffins & Pastries<em>$3</em></span></p>
<dl>
<dt>Mallory's Famous Snickerdoodles </dt>
<dd class="description">
<p>Creamy cinnamony goodness made from scratch with our founder Mallory's prizewinning recipe.</p>
</dd>
<dt>Oatmeal Cookie</dt>
<dd class="description">
<p>Packed with rolled oats, raisins, and cranberries, these monster cookies are (almost) good for ya!</p>
</dd>
<dt>Mixed Berry Muffins</dt>
<dd class="description">
<p>Filled with the best berries of the season and topped with a crumb crust. </p>
</dd>
<dt>Croissant</dt>
<dd class="description">
<p>Our oversized croissants are buttery, flaky, and usually all sold out by 7 a.m.</p>
</dd>
</dl>
</li>
</ul>
<table class="hours">
<thead>
<tr>
<th colspan="2">
<svg width="40" viewBox="0 0 800 800">
<g>
<g>
<g>
<g>
<g>
<path d="M340.261,358.231c17.896,0,33.647-8.998,43.067-22.706h70.971c16.318,0,29.548-13.219,29.548-29.537 c0-16.285-13.229-29.537-29.548-29.537h-70.981c-9.42-13.686-25.172-22.683-43.056-22.683c-0.278,0-0.533,0.089-0.8,0.089 l-64.706-91.065c-9.431-13.252-27.893-16.418-41.189-6.943c-13.297,9.442-16.418,27.871-6.976,41.201l64.761,91.11 c-2.044,5.588-3.333,11.531-3.333,17.84C288.03,334.87,311.402,358.231,340.261,358.231z"></path>
</g>
</g>
</g>
<g>
<g>
<g>
<path d="M273.034,654.322c-28.337-19.317-57.252-56.363-43.412-125.157h37.102c6.598,0,12.585-3.91,15.24-9.941 c2.622-6.099,1.4-13.119-3.099-17.962l-96.964-104.029c-3.144-3.366-7.531-5.266-12.164-5.266 c-4.599,0-8.986,1.911-12.13,5.266L60.655,501.262c-4.499,4.843-5.721,11.874-3.077,17.962 c2.655,6.031,8.631,9.941,15.196,9.941h34.824c3.021,11.742,40.246,147.407,156.86,151.361 c6.376,0.212,12.13-3.81,14.119-9.875S278.311,657.943,273.034,654.322z"></path>
</g>
</g>
</g>
<g>
<g>
<g>
<path d="M340.261,0C171.271,0,34.272,136.998,34.272,305.989c0,51.142,12.708,99.252,34.891,141.62l58.33-62.584 c-6.998-18.762-11.675-38.635-13.53-59.33h26.604c10.875,0,19.684-8.798,19.684-19.695c0-10.875-8.809-19.695-19.684-19.695 h-26.527c9.476-109.594,96.942-197.072,206.537-206.547v26.549c0,10.897,8.809,19.695,19.684,19.695 c10.886,0,19.695-8.798,19.695-19.695V79.757c109.584,9.475,197.072,96.953,206.537,206.547h-26.538 c-10.875,0-19.684,8.82-19.684,19.695c0,10.897,8.809,19.695,19.684,19.695h26.538 c-9.465,109.617-96.965,197.072-206.537,206.547v-26.538c0-10.896-8.809-19.694-19.695-19.694 c-10.875,0-19.684,8.798-19.684,19.694v26.427c-3.566-0.355-7.143-0.699-10.664-1.188c-0.044,0.101-0.044,0.211-0.089,0.3 c-7.576,17.263-24.46,28.293-43.1,28.293h-10.32c-0.533,16.529,2.566,30.726,9.109,42.867 c23.96,6.032,48.91,9.586,74.736,9.586c169.002,0,306.012-136.976,306.012-306C646.272,136.998,509.263,0,340.261,0z"></path>
</g>
</g>
</g>
</g>
</g>
</svg>
Hours
</th>
</tr>
</thead>
<tbody>
<tr>
<td>Mon. - Thurs.</td>
<td>6 a.m. - 9 p.m.</td>
</tr>
<tr>
<td>Fri. - Sat.</td>
<td>6 a.m. - 11 p.m.</td>
</tr>
<tr>
<td>Sunday</td>
<td>8 a.m. - 2 p.m.</td>
</tr>
</tbody>
</table>
</div>
@import url("https://fonts.googleapis.com/css2?family=Annie+Use+Your+Telescope&family=Neucha&family=Londrina+Solid:wght@300&display=swap");
body {
margin: 0;
padding: 0;
font-family: "Annie Use Your Telescope", Arial, Helvetica, sans-serif;
overflow-x: hidden;
padding: 5em;
box-sizing: border-box;
}
body:before,
body:after {
content: "";
background: url(https://images.unsplash.com/photo-1599229809585-f92ea053b547?w=1950&q=80)
no-repeat center 32%;
background-size: cover;
width: 100vw;
height: 100vh;
position: fixed;
top: 0;
left: 0;
z-index: -1;
}
body:after {
background: linear-gradient(45deg, #00000080, #00000080);
}
.content {
padding: 0 3em 3em;
margin-bottom: 3em;
border-radius: 0.05em;
max-width: 980px;
margin: 0 auto;
position: relative;
}
.content:before {
content: "";
background: url(https://www.toptal.com/designers/subtlepatterns/uploads/ep_naturalwhite.png);
width: 100%;
height: 100%;
position: absolute;
top: 0;
left: 0;
z-index: -1;
filter: invert(1);
opacity: 0.9;
}
h1 {
font-size: 6em;
margin: 0;
text-shadow: 0px 0px 5px #fff;
font-family: "Londrina Solid", Arial, Helvetica, sans-serif;
color: #fff;
font-weight: normal;
padding-top: 0.15em;
text-align: center;
}
h1:before {
content: "";
width: 1.25em;
height: 1.25em;
position: relative;
background: url(https://images.unsplash.com/photo-1579992357154-faf4bde95b3d?w=300&q=80)
no-repeat center center;
background-size: cover;
border-radius: 100% 100% 10% 100%;
display: inline-block;
border: 5px solid #fff;
box-shadow: 0 0 5px 0 #fff;
margin-left: -0.75em;
margin-top: -0.25em;
margin-right: 0.25em;
transform: rotate(-9deg);
}
h2 {
font-family: "Londrina Solid", Arial, Helvetica, sans-serif;
color: #666;
font-weight: normal;
margin: 0 0 0 -1.25em;
padding: 0 0.5em 0.15em 1.2em;
border-bottom: 0.1em solid #f60;
border-image-slice: 1;
border-image-source: linear-gradient(
90deg,
transparent,
#f60 10%,
#f60 90%,
#ffffff00
);
color: #ff9800;
width: calc(100% + 0.75em);
}
h2:before {
content: "\2605";
margin: 0 0.25em 0 -1.1em;
}
address {
text-align: center;
padding-left: 7em;
}
address p,
address a {
display: inline-block;
padding: 0 0.75em 0.5em 2em;
margin: 0.25em 0.5em 0.25em;
color: #212121;
font-size: 1.75em;
text-decoration: none;
filter: invert(1);
font-weight: bold;
border-radius: 50%;
text-shadow: -1px 1px 0 #fff;
height: 1em;
}
svg {
padding: 0.25em;
background: #0067ff;
border-radius: 100% 100% 0 100%;
transform: rotate(-10deg) translateY(-0.35em);
border: 3px solid #fff;
position: absolute;
left: 0;
}
table.hours {
display: inline-block;
transform: rotate(-2deg);
padding-left: 4.5em;
border-radius: 49%;
background: #353535;
text-align: center;
top: -10em;
position: relative;
left: 2em;
margin-bottom: -6em;
}
thead {
float: right;
width: 2em;
background: #ff9800;
height: 2.3em;
text-align: center;
font-size: 1.75em;
border-radius: 100% 100% 100% 5%;
padding: 0.5em;
line-height: 2em;
transform: rotate(25deg) translate(0.5em, -1em);
color: #fff;
border: 3px solid #0a090b;
}
thead tr {
transform: rotate(20deg) translateX(-0.2em);
}
tbody {
color: #a9a9a9;
font-size: 1.5em;
line-height: 1em;
text-shadow: -1px -1px 0px #000, -1px -1px 0px #000;
}
table.hours svg {
background: no-repeat;
filter: invert(1);
padding: 0;
transform: none;
left: 0.5em;
position: relative;
margin-bottom: -0.65em;
float: left;
border: 0;
}
ul.boxes {
margin: 0;
padding: 0;
list-style: none;
}
li.box {
width: 40%;
margin: 2% 4% 2% 5%;
display: inline-table;
box-sizing: border-box;
padding-left: 1em;
color: #fff;
font-size: 1.5em;
border-left: 0.15em solid #f60;
border-image-slice: 1;
border-right: 0.15em solid #f60;
border-image-source: linear-gradient(
180deg,
transparent,
#f60 20%,
#f60 60%,
#ffffff00 90%
);
padding-right: 1em;
padding-bottom: 4em;
}
li.box:after {
content: "";
float: left;
width: calc(100% + 4em);
border-bottom: 0.15em solid red;
border-image-slice: 1;
border-image-source: linear-gradient(
90deg,
transparent,
#f60 15%,
#f60 85%,
#ffffff00
);
margin-left: -2em;
height: 0.75em;
}
li.box:nth-child(1) {
transform: rotate(-1deg);
top: 1.5em;
position: relative;
}
li.box:nth-child(2) {
transform: rotate(2deg);
}
li.box:nth-child(3) {
transform: rotate(3deg);
top: -5em;
position: relative;
}
li.box:nth-child(4) {
transform: rotate(-2deg);
position: relative;
top: -1.5em;
}
dt {
font-weight: bold;
color: white;
float: left;
width: 100%;
font-size: 1.25em;
line-height: 1.25em;
}
dd.description {
margin: 0 0 1em 0.25em;
float: left;
width: 100%;
color: #999;
line-height: 1em;
padding-left: 0.5em;
}
dd.description p {
margin: 0;
}
dd.description:before {
color: #ff9800;
float: left;
margin-right: 0.25em;
margin-left: -1.05em;
content: "\2570";
}
p.prices {
float: left;
width: 100%;
font-size: 0.9em;
}
p.prices span {
display: block;
text-align: right;
color: #ff9800;
float: left;
padding-left: 0.25em;
}
p.prices span + span {
float: right;
}
p.prices span em {
background: #ff9800;
padding: 0 0.35em;
color: #000000;
font-weight: bold;
border-radius: 100% 100% 100% 10%;
margin-left: 0.25em;
}
span.note {
font-size: 0.85em;
padding-top: 0.25em;
}
span.note em {
margin-right: 0.25em;
}
p.tip {
color: #607d8b;
font-weight: bold;
line-height: 1em;
padding-left: 1em;
margin-bottom: 0;
}
p.tip:before {
content: "\22C6";
color: #607d8b;
float: left;
margin-right: 0.25em;
margin-left: -0.75em;
}
@media only screen and (max-width: 980px) {
address {
text-align: left;
padding-left: 5em;
}
h1 {
font-size: 4em;
}
li.box {
width: 92%;
}
li.box:nth-child(3) {
transform: rotate(-3deg);
top: 0;
}
li.box:nth-child(4) {
transform: rotate(2deg);
top: 0;
}
table {
margin-top: 8em;
}
}
@media only screen and (max-width: 767px) {
body {
padding: 0em;
}
.content {
width: 100%;
padding: 0;
overflow: hidden;
}
h1 {
font-size: 2.5em;
text-align: left;
padding-left: 0.25em;
}
h1::before {
margin-top: 0.25em;
margin-left: 0.15em;
margin-bottom: -0.25em;
}
address {
text-align: left;
padding-left: 1.75em;
margin-top: 1em;
font-size: 0.8em;
}
address svg {
border: 0;
margin-top: 0.15em;
}
body:before,
body:after {
display: none;
}
li.box {
width: 85%;
margin-left: 7.5%;
}
table.hours {
padding-left: 1em;
margin-left: -2em;
}
thead {
transform: rotate(0deg) translate(0.5em, -1em);
}
}
Also see: Tab Triggers