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>
<html lang="en">
<head>
<meta charset="UTF-8">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<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=EB+Garamond:ital,wght@0,400..800;1,400..800&display=swap" rel="stylesheet">
<link rel="stylesheet" href="styles.css">
<link rel="stylesheet" href="https://use.fontawesome.com/releases/v5.8.1/css/all.css">
<title>Your Product Landing Page</title>
</head>
<body>
<header class="header">
<div class="logo-nav-container">
<img class="header-img" src="https://cdn.freecodecamp.org/testable-projects-fcc/images/product-landing-page-logo.png" alt="Logo">
<nav class="nav-bar">
<ul>
<li><a class="nav-link" href="#features">Features</a></li>
<li><a class="nav-link" href="#how-it-works">How It Works</a></li>
<li><a class="nav-link" href="#pricing">Pricing</a></li>
</ul>
</nav>
</div>
</header>
<div class="page-wrapper">
<section class="hero">
<h2>Handcrafted, home-made masterpieces</h2>
<form class="form" action="https://www.freecodecamp.com/email-submit">
<input
name="email"
class="email"
type="email"
placeholder="Enter your email address"
required
/>
<input class="submit" type="submit" value="Get Started" class="btn" />
</form>
</section>
<div class="container">
<section class="features flex-container">
<div class="grid">
<div class="icon"><i class="fa fa-3x fa-fire"></i></div>
<div class="desc">
<h2>Premium Materials</h2>
<p>
Our trombones are crafted from high-quality brass, which ensures durability and a superior sound. We source our materials locally to guarantee the best quality and longevity.
</p>
</div>
</div>
<div class="grid">
<div class="icon"><i class="fa fa-3x fa-truck"></i></div>
<div class="desc">
<h2>Fast Shipping</h2>
<p>
We expedite the shipping process to get your trombone to you as quickly as possible. Enjoy fast delivery and free returns if you are not completely satisfied with your purchase.
</p>
</div>
</div>
<div class="grid">
<div class="icon"><i class="fa fa-3x fa-battery-full" aria-hidden="true"></i></div>
<div class="desc">
<h2>Quality Assurance</h2>
<p>
Each trombone undergoes rigorous quality checks to ensure it is free from defects. We test the pitch and overall condition to provide you with an instrument of the highest quality.
</p>
</div>
</div>
</section>
<section class="how-it-works">
<iframe
class="video"
height="315"
src="https://www.youtube-nocookie.com/embed/y8Yv4pnO7qc?rel=0&controls=0&showinfo=0"
frameborder="0"
allowfullscreen
></iframe>
</section>
<section class="pricing flex-container">
<div class="product tenor">
<div class="level">Tenor Trombone</div>
<h2>$600</h2>
<ol>
<li>Rich, full sound with a broad range.</li>
<li>Ideal for both solo and ensemble performances.</li>
<li>Includes a hard case and mouthpiece.</li>
<li>Available in various finishes.</li>
</ol>
<button class="btn">Select</button>
</div>
<div class="product bass">
<div class="level">Bass Trombone</div>
<h2>$900</h2>
<ol>
<li>Powerful low-end tones with excellent projection.</li>
<li>Perfect for orchestral and jazz settings.</li>
<li>Features a dual-trigger system for enhanced flexibility.</li>
<li>Comes with a deluxe case and a pair of mouthpieces.</li>
</ol>
<button class="btn">Select</button>
</div>
<div class="product valve">
<div class="level">Valve Trombone</div>
<h2>$1200</h2>
<ol>
<li>Plays similarly to a trumpet with valves for ease of play.</li>
<li>Excellent for jazz bands and modern music.</li>
<li>Features a lightweight design and smooth action valves.</li>
<li>Includes a padded case and maintenance kit.</li>
</ol>
<button class="btn">Select</button>
</div>
</section>
<footer>
<ul>
<li><a href="#">Privacy</a></li>
<li><a href="#">Terms</a></li>
<li><a href="#">Contact</a></li>
</ul>
<span>Copyright 2023, Original Trombones</span>
</footer>
</div>
</div>
</body>
</html>
* {
margin: 0;
padding: 0;
}
html {
scroll-behavior: smooth;
}
body {
font-family: 'EB Garamond', serif;
background-color: #f2f2f2;
color: #333;
padding-top: 70px;
}
/* Header Styles */
.logo-nav-container {
display: flex;
justify-content: space-between;
align-items: center;
padding: 20px;
}
.header {
position: fixed;
width: 100%;
background-color: #f2f2f2;
z-index: 1000;
box-shadow: 0 4px 6px rgba(0, 0, 0, 0.1);
top: 0;
border-radius: 0 0 10px 10px;
}
.header-img {
max-height: 50px;
border-radius: 50%;
}
.nav-bar {
display: flex;
align-items: center;
}
.nav-bar ul {
list-style: none;
display: flex;
}
.nav-bar li {
margin-right: 20px;
}
.nav-bar a {
text-decoration: none;
color: #333;
font-weight: bold;
transition: color 0.3s;
}
.nav-bar a:hover {
color: #FFD700;
}
/* Main Content Styles */
.page-wrapper {
max-width: 1200px;
margin: 0 auto;
padding: 120px 20px;
min-height: 100vh;
}
.hero {
text-align: center;
padding: 50px 0;
}
.form {
margin-top: 20px;
margin-bottom: 20px;
}
.email {
padding: 10px;
width: 300px;
border-radius: 5px;
}
.submit {
padding: 10px 20px;
margin-left: 10px;
background-color: #FFD700;
color: #000;
border: none;
cursor: pointer;
transition: background-color 0.3s, color 0.3s;
border-radius: 5px;
}
.submit:hover {
background-color: #FFC107;
color: #333;
}
/* Features Section Styles */
.flex-container {
display: flex;
justify-content: space-around;
align-items: stretch;
flex-wrap: wrap;
}
.grid {
text-align: center;
padding: 20px;
flex: 1;
border-radius: 10px;
}
.icon {
color: #F08000;
margin-bottom: 10px;
}
.desc {
font-size: 1.1em;
}
/* How It Works Section Styles */
.how-it-works {
text-align: center;
padding: 50px 0;
}
.video {
width: 60%;
border-radius: 10px;
}
/* Pricing Section Styles */
.product {
text-align: center;
padding: 20px;
border: 1px solid #ccc;
margin-bottom: 20px;
transition: transform 0.3s, box-shadow 0.3s;
border-radius: 10px;
}
.product:hover {
transform: scale(1.05);
box-shadow: 0 4px 8px rgba(0, 0, 0, 0.2);
}
.product ol {
list-style-type: none;
}
.product ol li {
text-align: left;
margin-bottom: 10px;
}
.level {
font-size: 1.2em;
font-weight: bold;
margin-bottom: 10px;
}
.pricing button {
background-color: #FFD700;
color: #000;
padding: 10px 20px;
border: none;
cursor: pointer;
transition: background-color 0.3s, color 0.3s;
border-radius: 5px;
}
/* Footer Styles */
footer {
background-color: #333;
color: #fff;
text-align: center;
padding: 20px 0;
position: relative;
bottom: 0;
width: 100%;
box-shadow: 0 -4px 6px rgba(0, 0, 0, 0.1);
}
footer ul {
list-style: none;
padding: 0;
margin: 0 0 10px 0;
display: flex;
justify-content: center;
}
footer li {
margin: 0 15px;
}
footer a {
color: #FFD700;
text-decoration: none;
transition: color 0.3s;
}
footer a:hover {
color: #FFC107;
}
footer span {
display: block;
margin-top: 10px;
font-size: 0.9em;
}
/* For tablets */
@media (max-width: 768px) {
.logo-nav-container {
flex-direction: column;
text-align: center;
}
.nav-bar ul {
flex-direction: column;
}
.nav-bar li {
margin: 10px 0;
}
.page-wrapper {
padding: 90px 10px;
}
.email {
width: 100%;
margin-bottom: 10px;
}
.submit {
width: 100%;
}
.video {
width: 100%;
}
.flex-container {
flex-direction: column;
}
.grid {
margin-bottom: 20px;
}
.product {
padding: 10px;
transform: none !important;
box-shadow: none !important;
}
}
/* For mobile phones */
@media (max-width: 480px) {
.logo-nav-container {
padding: 10px;
}
.header-img {
max-height: 40px;
}
.nav-bar a {
font-size: 0.9em;
}
.hero h2 {
font-size: 1.5em;
}
.email {
width: 100%;
}
.submit {
width: 100%;
}
.flex-container {
flex-direction: column;
}
.grid {
padding: 10px;
}
.video {
width: 100%;
}
.product {
padding: 10px;
transform: none !important;
box-shadow: none !important;
}
.product h2 {
font-size: 1.5em;
}
.product ol li {
font-size: 0.9em;
}
footer ul {
flex-direction: column;
}
footer li {
margin: 5px 0;
}
}
Also see: Tab Triggers