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.
<!DOCTYPE html>
<hmtl lang="en">
<head>
<meta charset="UTF-8" />
<meta name="viewport" content="width=device-width, initial-scale=1.0"/>
<meta name="description" content="freeCodeCamp product landing page project" />
<link rel="stylesheet" type="text/css" href="./styles.css" />
<link
rel="stylesheet"
href="https://use.fontawesome.com/releases/v5.8.1/css/all.css"
integrity="sha384-50oBUHEmvpQ+1lW4y57PTFmhCaXp0ML5d60M1M7uH2+nqUivzIebhndOJK28anvf"
crossorigin="anonymous"
/>
<title>Product Landing Page</title>
</head>
<body>
<header id="header">
<div class="logo">
<img id="header-img" src="https://cdn-icons-png.flaticon.com/512/1071/1071138.png?w=900&t=st=1655138575~exp=1655139175~hmac=40b7dac2a7be07435ac4fd1ea05c5bd4d7bbf094b45cc72a0aebfad7957ad0ba" alt="stroopwafel drawing"/>
<h1>Original Stroopwafels</h1>
</div>
<nav id="nav-bar">
<ul>
<li><a class="nav-link" href="#About">About</a></li>
<li><a class="nav-link" href="#How_to_eat">How to eat</a></li>
<li><a class="nav-link" href="#Pricing">Pricing</a></li
</ul>
</nav>
</header>
<main>
<section id="hero">
<h2>Handcrafted, Dutch cookies</h2>
<p>Made <span class="orange">fresh</span> daily
<!-- Replace action with actual website server -->
<form id="form" action="https://www.freecodecamp.com/email-submit" method="get">
<input id="email" type="email" name="email" placeholder="Enter your email address" required></input>
<input id="submit" type="submit" value="GET SPECIAL OFFERS" />
</form>
</section>
<section id="About">
<div class="img-txt">
<i class="icon fa fa-stroopwafel"></i>
<div class="txt">
<h2>Dutch Tradition</h2>
<p>A stroopwafel (Dutch pronunciation: [ˈstroːpˌʋaːfəl]; literally 'syrup waffle') is a thin, round waffle cookie made from two layers of sweet baked dough held together by caramel filling. According to Dutch culinary folklore, stroopwafels were first made in Gouda either during the late 18th century or the early 19th century by bakers repurposing scraps and crumbs by sweetening them with syrup. Stroopwafels were not found outside Gouda until 1870, by which point the city was home to around 100 syrup-waffle bakers. Today, stroopwafels are a well-known Dutch treat popular throughout the Netherlands and the former Dutch Empire, and exported abroad.
</p>
</div>
</div>
<div class="img-txt">
<i class="icon fa fa-fire"></i>
<div class="txt">
<h2>Classic Flavor</h2>
<p>We make our stroopwafels from simple ingredients, the traditional way. Stiff dough of flour, butter, brown sugar, yeast, milk, and eggs is pressed in a hot waffle iron until crisped. While still warm, the waffles are shaped into a circle with a cookie cutter and pulled apart into top and bottom wafers. At last, a warm caramel filling made from syrup, brown sugar, butter, and cinnamon is spread between the wafers, then the waffle is reassembled.</p>
</div>
</div>
<div class="img-txt">
<i class="icon fa fa-truck"></i>
<div class="txt">
<h2>Available Today</h2>
<p>Our stroopwafel are made to order and delivered same-day within the greater city metropolitan area. Get them even faster by stopping by our cart in the park!</p>
</div>
<div>
</section>
<section id="How_to_eat">
<div class="video-container">
<iframe id="video" src="https://www.youtube.com/embed/zBBK8O8vF0k"
height="225"
width="400"
title="YouTube video player" frameborder="0" allow="accelerometer; clipboard-write; encrypted-media; gyroscope; picture-in-picture" allowfullscreen>
</iframe>
</div>
</section>
<!-- Add JS to save selections in cart for checkout -->
<section id="Pricing">
<div class="pricing-container">
<div class="product" id="classic">
<h2>Classic Caramel (6-pack)</h2>
<h3>$4.99</h3>
<div class="select-wrapper">
<select id="dropdown" name="classic-order">
<option value="">Choose a quantity</option>
<option value="1">1 pack</option>
<option value="3">3 packs</option>
<option value="6">6 packs</option>
<option value="9">9 packs</option>
<option value="12">12 packs</option>
</select>
</div>
</div>
<div class="product" id="honey">
<h2>Honey-filled (6-pack)</h2>
<h3>$4.99</h3>
<div class="select-wrapper">
<select id="dropdown" name="honey-order">
<option value="">Choose a quantity</option>
<option value="1">1 pack</option>
<option value="3">3 packs</option>
<option value="6">6 packs</option>
<option value="9">9 packs</option>
<option value="12">12 packs</option>
</select>
</div>
</div>
<div class="product" id="chocolate">
<h2>Chocolate-dipped (6-pack)</h2>
<h3>$5.99</h3>
<div class="select-wrapper">
<select id="dropdown" name="chocolate-order">
<option value="">Choose a quantity</option>
<option value="1">1 pack</option>
<option value="3">3 packs</option>
<option value="6">6 packs</option>
<option value="9">9 packs</option>
<option value="12">12 packs</option>
</select>
</div>
</div>
</div>
<input id="order" type="button" value="GO TO CHECKOUT" />
</section>
</main>
<!-- Add hyperlinks to footer -->
<footer>
<ul>
<li><a class="foot-link" href="#">Contact</a></li>
<li><a class="foot-link" href="#">Privacy</a></li>
<li><a class="foot-link" href="#">Terms</a></li
<div>
</div>
</ul>
<!-- Replace with copyright information -->
<p>Copyright 2022, Original Stroopwafels</p>
</footer>
</body>
</html>
* {
margin: 0;
padding: 0;
box-sizing: border-box;
}
body {
font-family: sans-serif;
}
header {
display: flex;
flex-direction: row;
align-items: center;
position: fixed;
top: 0;
left: 0;
min-height: 70px;
width: 100%;
justify-content: space-between;
gap: 10%;
padding: 20px 20px 20px 5%;
background: white;
color: #A91F32;
z-index: 9999;
}
.logo {
display: flex;
width: 250px;
height: 70px;
flex-direction: row;
align-items: center;
justify-content: flex-start;
}
h1 {
text-align: center;
font-family: helvetica;
}
.logo img {
max-height: 70px;
max-width: auto;
}
#nav-bar {
width: 100%;
max-width: 30rem;
font-size: 1.2rem;
}
li {
list-style: none;
}
.nav-link {
text-decoration: none;
color: #1E4785;
font-weight: bold;
padding: 5px;
border-radius: 5px;
}
.nav-link:hover {
background: #A91F32;
}
nav > ul {
width: 100%;
display: flex;
flex-direction: row;
height: 1.5rem;
justify-content: space-around;
}
@media (max-width: 650px) {
header {
flex-direction: column;
padding-bottom: 0;
padding-left: 0;
padding-right: 0;
}
nav {
margin-top: 10px;
}
}
main {
position: relative;
padding: 20px;
}
.orange {
font-style: italic;
color: #A91F32;
font-weight: 600;
}
#hero {
display: flex;
flex-direction: column;
align-items: center;
justify-content: center;
text-align: center;
height: 200px;
margin-top: 90px;
background: #1E4785;
color: white;
}
#hero > h2 {
word-wrap: break-word;
}
#hero > p {
font-size: 1.2rem;
margin-bottom: 20px;
margin-top: 5px;
}
#hero input[type='email'] {
max-width: 275px;
width: 100%;
padding: 3px 8px;
font-size: .9rem;
}
#hero input[type='submit'] {
max-width: 200px;
width: 100%;
height: 30px;
margin: 15px 15px 5px 15px;
border: 0;
background-color: #A91F32;
color: white;
font-weight: 600;
padding: 5px;
border-radius: 5px;
}
#hero input[type='submit']:hover {
color: #1E4785;
transition: color 1s;
cursor: pointer;
}
@media (max-width: 650px) {
#hero {
margin-top: 100px;
}
}
.img-txt {
display: flex;
}
.icon {
color: #A91F32;
}
section {
margin: 40px auto 0 auto;
}
i {
font-size: 3rem;
padding-top: 4px;
min-width: 5rem;
max-width: 5rem;
text-align: center;
}
.img-txt {
display: flex;
color: black;
margin-bottom: 1.5rem;
justify-content: start;
}
.txt {
padding-left: 1rem;
}
.txt h2 {
color: #1E4785;
margin-bottom: .3rem;
}
@media (max-width: 550px) {
main {
padding-left: 0;
padding-right: 0;
}
#About {
margin-top: 0;
}
.img-txt .icon {
display: none;
}
.img-txt {
margin: 0;
}
.txt {
text-align: center;
padding: 0 1rem;
}
.txt h2 {
margin-bottom: 0;
}
}
#How_to_eat {
max-height: 480px;
overflow: hidden;
}
.video-container {
padding-bottom: 56.25%;
padding-top: 35px;
height: 0;
position: relative;
overflow: hidden;
max-height: 480px;
max-width: 854px;
margin-left: auto;
margin-right: auto;
}
.video-container iframe {
position: absolute;
top: 0;
border: 0;
width: 100%;
height: 100%;
padding: 0;
max-height: 480px;
}
@media (max-width: 850px) {
#Pricing {
margin-top: 35px;
}
}
.product {
align-items: center;
text-align: center;
display: flex;
flex-direction: column;
margin: 20px;
width: calc(100%/3);
height: 200px;
max-width: 400px;
border: 1px solid black;
}
.product h2, .product h3, .select-wrapper {
height: calc(200px/3);
width: 100%;
line-height: calc(200px/3);
padding: 0 1rem;
}
.pricing-container {
display: flex;
flex-direction: row;
justify-content: center;
}
.product h2 {
background: #A91F32;
font-size: 1.1rem;
color: white;
overflow: hidden;
}
.select-wrapper {
background: #1E4785;
color: white;
}
.product select {
margin-top: 10px;
max-width: 100%
}
#order {
max-width: 200px;
width: 100%;
height: 30px;
display: block;
margin: 0 auto;
border: 0;
background-color: #A91F32;
color: white;
font-weight: 600;
padding: 5px;
border-radius: 5px;
}
#order:hover {
background: #1E4785;
transition: background 1s;
cursor: pointer;
}
@media (max-width: 750px) {
.pricing-container {
flex-direction: column;
}
.product {
max-width: 300px;
width: 100%;
margin: 0 auto;
margin-bottom: 10px;
height: 150px;
}
.product h2, .product h3, .select-wrapper {
height: calc(150px/3);
width: 100%;
line-height: calc(150px/3);
padding: 0 1rem;
}
}
footer {
background: #1E4785;
margin: 100px 20px 0 20px;
color: white;
padding: 1rem 2rem;
display: flex;
flex-direction: column;
text-align: right;
}
.foot-link {
text-decoration: none;
color: white;
font-weight: bold;
}
footer ul {
display: flex;
flex-direction: row;
justify-content: flex-end;
margin-bottom: 1rem;
}
footer li {
padding: 0 1rem;
}
/* hack way to fix nav link offset */
section::before {
display: block;
content: " ";
margin-top: -150px;
height: 150px;
visibility: hidden;
pointer-events: none;
}
Also see: Tab Triggers