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.
<link rel="preconnect" href="https://fonts.googleapis.com">
<link rel="preconnect" href="https://fonts.gstatic.com" crossorigin>
<link href="https://fonts.googleapis.com/css2?family=Merriweather:wght@300&display=swap" rel="stylesheet">
<link rel="preconnect" href="https://fonts.googleapis.com">
<link rel="preconnect" href="https://fonts.gstatic.com" crossorigin>
<link href="https://fonts.googleapis.com/css2?family=Nunito+Sans:wght@300;400;600&display=swap" rel="stylesheet">
<header id="header">
<div>
<img src="https://cdn.freecodecamp.org/testable-projects-fcc/images/product-landing-page-logo.png" alt="Logo" id="header-img">
</div>
<nav id="nav-bar">
<a href="#hero" class="nav-link">How it Works</a>
<a href="#features" class="nav-link">Features</a>
<a href="#pricing" class="nav-link">Pricing</a>
</nav>
</header>
<main>
<section id="hero">
<div id="hero-email">
<h1>Handcrafted, home-made masterpieces</h1>
<form action="https://www.freecodecamp.com/email-submit" id="form">
<input type="email" name="email" id="email" placeholder="Enter your email address">
<input type="submit" id="submit" value="Get started" class="button">
</form>
</div>
<div id="hero-video">
<iframe id="video" width="560" height="315" src="https://www.youtube.com/embed/y8Yv4pnO7qc" title="Roman Carnival Overture Op. 9 for Five Trombones" frameborder="0" allow="accelerometer; autoplay; clipboard-write; encrypted-media; gyroscope; picture-in-picture" allowfullscreen></iframe>
</div>
</section>
<section id="features">
<ul>
<li class="feature-item">
<i class="fa fa-fire-flame-curved fa-3x"></i>
<div>
<h2>Premium Materials</h2>
<p>Our trombones use the shiniest brass which is sourced locally. This will increase the longevity of your purchase.</p>
</div>
</li>
<li class="feature-item">
<i class="fa-solid fa-truck fa-3x"></i>
<div>
<h2>Fast Shipping</h2>
<p>We make sure you recieve your trombone as soon as we have finished making it. We also provide free returns if you are not satisfied.</p>
</div>
</li>
<li class="feature-item">
<i class="fa-solid fa-battery-full fa-3x"></i>
<div>
<h2>Quality Assurance</h2>
<p>For every purchase you make, we will ensure there are no damages or faults and we will check and test the pitch of your instrument.</p>
</div>
</li>
</ul>
</section>
<section id="pricing">
<div class="card">
<h2 class="card-title">TENOR TROMBONE</h2>
<h1 class="card-price">$600</h1>
<hr />
<p class="card-benefit">
<i class="fa-solid fa-circle-check"></i>
Lorem, ipsum dolor
</p>
<p class="card-benefit">
<i class="fa-solid fa-circle-check"></i>
Lorem, ipsum dolor
</p>
<p class="card-benefit">
<i class="fa-solid fa-circle-check"></i>
Lorem, ipsum dolor
</p>
<p class="card-feature">
<i class="fa-solid fa-circle-check"></i>
Lorem, ipsum dolor
</p>
<button class="button card-button">Select <i class="fa-solid fa-arrow-right"></i></button>
</div>
<div class="card">
<h2 class="card-title">TENOR TROMBONE</h2>
<h1 class="card-price">$600</h1>
<hr />
<p class="card-benefit">
<i class="fa-solid fa-circle-check"></i>
Lorem, ipsum dolor
</p>
<p class="card-benefit">
<i class="fa-solid fa-circle-check"></i>
Lorem, ipsum dolor
</p>
<p class="card-benefit">
<i class="fa-solid fa-circle-check"></i>
Lorem, ipsum dolor
</p>
<p class="card-feature">
<i class="fa-solid fa-circle-check"></i>
Lorem, ipsum dolor
</p>
<button class="button card-button">Select <i class="fa-solid fa-arrow-right"></i></button>
</div>
<div class="card">
<h2 class="card-title">TENOR TROMBONE</h2>
<h1 class="card-price">$600</h1>
<hr />
<p class="card-benefit">
<i class="fa-solid fa-circle-check"></i>
Lorem, ipsum dolor
</p>
<p class="card-benefit">
<i class="fa-solid fa-circle-check"></i>
Lorem, ipsum dolor
</p>
<p class="card-benefit">
<i class="fa-solid fa-circle-check"></i>
Lorem, ipsum dolor
</p>
<p class="card-feature">
<i class="fa-solid fa-circle-check"></i>
Lorem, ipsum dolor
</p>
<button class="button card-button">Select <i class="fa-solid fa-arrow-right"></i></button>
</div>
</section>
</main>
<footer id="footer">
<p>
Copyright © <script>
document.write(new Date().getFullYear())
</script> - All right reserved
</p>
<ul>
<li><a href="#">Privacy</a></li>
<li><a href="#">Terms</a></li>
<li><a href="#">Contact</a></li>
</ul>
</footer>
:root {
--primary-color: #f1c40f;
--gray: #6b7280;
--gray-dark: #4a5568;
--gray-light: #dddddd;
--black: #000;
--white: #fff;
--bp-small: 360px;
--bp-medium: 640px;
--bp-large: 1024px;
}
html {
font-size: 62.5%;
scroll-behavior: smooth;
scroll-padding: 150px;
}
body,
ul {
font-size: 1.6rem;
font-family: "Merriweather", serif;
padding: 0;
margin: 0;
color: var(--gray);
}
#nav-bar {
font-family: Helvetica, Arial, sans-serif;
font-weight: bolder;
}
h1,
h2,
h3,
h4,
h6 {
font-family: Helvetica, Arial, sans-serif;
font-weight: lighter;
color: var(--black);
}
#header {
width: 100%;
height: 75px;
display: flex;
flex-direction: column;
align-items: center;
justify-content: space-between;
background-color: var(--primary-color);
position: sticky;
top: 0;
padding: 1.6rem 0;
z-index: 1;
}
#header-img {
width: 300px;
}
#nav-bar {
width: 50%;
display: flex;
align-items: center;
justify-content: space-evenly;
}
#nav-bar a {
margin: 0 1.6rem;
text-decoration: none;
color: #000;
}
#hero {
display: flex;
flex-direction: column;
justify-content: space-between;
background: radial-gradient(
circle,
rgba(119, 111, 92, 1) 0%,
rgba(238, 229, 211, 1) 100%
);
}
#hero-email {
align-self: center;
text-align: center;
margin-top: 6rem;
}
#form {
display: flex;
flex-direction: column;
align-items: center;
gap: 2.4rem;
}
#form input[type="email"] {
width: 250px;
padding: 0.4rem;
font-size: 1.4rem;
}
#form input[type="submit"] {
}
#form input[type="submit"]:hover,
#form input[type="submit"]:focus {
}
#hero-video {
width: 100%;
display: grid;
grid-template-columns: repeat(16, 1fr);
grid-template-rows: repeat(9, 1fr);
position: relative;
margin: 6rem 0;
background-color: var(--gray-light);
}
#hero-video::before {
content: "";
display: block;
padding-bottom: 100%;
}
#hero-video > iframe {
position: absolute;
width: 100%;
height: 100%;
}
#features {
margin: 0 1.6rem;
text-align: center;
}
#features ul {
list-style: none;
}
.feature-item {
margin: 6rem 0;
}
.feature-item > i {
display: none;
}
#pricing {
display: flex;
flex-direction: column;
gap: 1.6rem;
margin: 6rem 1.6rem;
}
.card {
border: 2px solid var(--gray);
border-radius: 15px;
padding: 3.2rem;
}
.card-title {
font-size: 1.4rem;
margin: 0;
color: #6b7280;
margin-bottom: 0.8rem;
}
.card-price {
font-size: 4rem;
margin: 0;
margin-bottom: 0.8rem;
}
.card-benefit {
color: #6b7280;
margin: 1.6rem 0;
}
.card-button {
width: 100%;
display: flex;
flex-direction: row;
justify-content: space-between;
align-items: center;
}
.button {
--clr: #5559ab;
--outline: 2px solid var(--gray-dark);
outline: var(--outline);
transition: outline-offset 200ms ease;
padding: 1.2rem;
border: 2px solid var(--gray-dark);
border-radius: 5px;
cursor: pointer;
font-weight: 800;
text-transform: uppercase;
color: var(--black);
background-color: var(--primary-color);
}
.button:hover,
.button:focus {
outline: var(--outline);
outline-offset: -6px;
}
#footer {
height: 80px;
padding: 1.6rem;
display: flex;
flex-direction: column;
justify-content: center;
align-items: center;
background-color: var(--gray-light);
}
#footer ul {
list-style: none;
display: flex;
gap: 1.6rem;
}
#footer p {
color: var(--gray-dark);
}
#footer a {
text-decoration: none;
color: var(--black);
font-weight: bold;
}
@media screen and (min-width: 640px) {
#hero {
flex-direction: row;
justify-content: center;
}
#hero-video {
width: 560px;
margin-left: 3.2rem;
margin-right: 3.2rem;
}
#features {
width: 640px;
margin: 0 auto;
text-align: left;
}
.feature-item {
display: flex;
align-items: center;
}
.feature-item > i {
margin: 0 1.6rem;
display: block;
color: var(--primary-color);
}
#pricing {
flex-direction: row;
justify-content: center;
}
.card {
width: 31.3rem;
}
#footer {
height: 80px;
padding: 1.6rem 3.2rem;
flex-direction: row;
justify-content: space-between;
}
}
@media screen and (min-width: 360px) {
#pricing {
margin-left: 6rem;
margin-right: 6rem;
}
}
Also see: Tab Triggers