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.
<head>
<script src="https://kit.fontawesome.com/a7d8db710a.js"></script>
<link href="https://fonts.googleapis.com/css?family=Lato:400,700,900&display=swap" rel="stylesheet">
</head>
<body id="body">
<header id="header">
<img src="https://s3.amazonaws.com/freecodecamp/original_trombones.png" id="header-img">
<nav id="nav-bar">
<ul>
<li><a href="#features" class="nav-link">Features</a></li>
<li><a href="#products" class="nav-link">How it works</a></li>
<li><a href="#pricing" class="nav-link">Pricing</a></li>
</ul>
</nav>
</header>
<div id="container">
<div id="get-started">
<h2 class="title">Handcrafted, home-made masterpieces</h2>
<form action="https://www.freecodecamp.org/email-submit">
<input id="email-input" type="email" placeholder="Enter your email address"><br>
<input id="submit-email" type="submit" value="Get started!" name="submit">
</form>
</div>
<div id="features">
<i class="icon fas fa-fire fa-3x"></i>
<div>
<h2 class="title">Premium Materials</h2>
<p>Our trombones use the shiniest brass which is sourced locally. This will increase the longevity of your purchase.</p>
</div>
<i class="icon fas fa-truck fa-3x"></i>
<div>
<h2 class="title">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>
<i class="icon fas fa-battery-full fa-3x"></i>
<div>
<h2 class="title">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>
</div>
<div id="products">
<h2 class="title">How it works</h2>
<p>This is what you could do with one of our trombones!</p>
<iframe id="video" width="560" height="315" src="https://www.youtube.com/embed/y8Yv4pnO7qc" frameborder="0" allow="accelerometer; autoplay; encrypted-media; gyroscope; picture-in-picture" allowfullscreen></iframe>
</div>
<div id="pricing">
<h2 class="title">Pricing</h2>
<div id="price-grid">
<div class="grid-item">
<h3>Tenor trombone</h3>
<p class="price">$600</p>
<p>Lorem ipsum dolor sit amet, consectetur adipiscing elit, sed do eiusmod tempor incididunt ut labore et dolore magna aliqua. Ut enim ad minim veniam, quis nostrud exercitation ullamco laboris nisi ut aliquip ex ea commodo consequat.</p>
<button class="select-item">Select</button>
</div>
<div class="grid-item">
<h3>Bass trombone</h3>
<p class="price">$900</p>
<p>Bacon ipsum dolor amet burgdoggen alcatra buffalo, meatball shank kevin shankle venison filet mignon leberkas. Ribeye tri-tip kevin sirloin burgdoggen doner beef ribs ball tip pork loin. Filet mignon swine picanha turducken capicola.</p>
<button class="select-item">Select</button>
</div>
<div class="grid-item">
<h3>Valve trombone</h3>
<p class="price">$1200</p>
<p>Lorem ipsum dolor amet lomo try-hard bespoke, pop-up locavore poutine wayfarers portland tbh helvetica. Squid godard before they sold out vexillologist sustainable slow-carb man braid hella pop-up messenger bag crucifix vice marfa tumblr. </p>
<button class="select-item">Select</button>
</div>
</div>
</div>
</div>
<footer id="footer">
<ul>
<li><a class="footer-link" href=""#>Privacy</a></li>
<li><a class="footer-link" href=""#>Terms</a></li>
<li><a class="footer-link" href=""#>Contact</a></li>
</ul>
<p>Copyright 2019 <strong>© Original Trombones</strong></p>
</footer>
</body>
html {
box-sizing: border-box;
width: 100%;
height: 100%;
}
*, *:before, *:after {
box-sizing: inherit;
margin: 0;
}
#body {
font-family: Lato, sans-serif;
font-size: 16px;
}
#header {
width: 100%;
height: 60px;
background: #D8D8D8;
display: flex;
position: fixed;
top: 0;
flex-direction: row;
align-items: center;
justify-content: space-between;
padding: 0 50px;
}
#header-img {
width: 300px;
height: 30px;
}
#nav-bar {
display: flex;
flex-direction: row;
justify-content: flex-end;
align-items: center;
}
#nav-bar ul {
margin-top: 15px;
list-style-type: none;
display: flex;
flex-direction: row;
align-items: center;
padding-bottom: 15px;
}
.nav-link {
text-decoration: none;
color: black;
font-weight: bold;
font-size: 18px;
margin: 0 15px;
}
.nav-link:hover, .footer-link:hover {
color: #f54f41;
}
#container {
margin-top: 60px;
display: flex;
flex-direction: column;
align-items: center;
justify-content: space-between;
}
.title {
color: #f54f41;
font-weight: 600;
}
#get-started, #features, #products, #pricing {
margin: 25px 0;
}
#get-started {
height: 120px;
display: flex;
flex-direction: column;
align-items: center;
justify-content: space-around;
}
form {
width: 100%;
display: flex;
flex-direction: column;
align-items: center;
}
#email-input {
width: 450px;
height: 30px;
margin-top: 5px;
border: 1px solid #f54f41;
border-radius: 5px;
text-indent: 5px;
}
#submit-email {
width: 180px;
font-size: 18px;
background: #f54f41;
color: white;
border: none;
border-radius: 5px;
margin: 8px;
padding: 2px 10px;
}
#email-input:hover , #submit-email:hover {
cursor: pointer;
box-shadow: 2px 3px 5px #D8D8D8;
}
#email-input:hover {
color: #f54f41;
}
#features {
width: 800px;
display: grid;
grid-template-rows: repeat(1fr, 3);
grid-template-columns: 10% 80%;
grid-column-gap: 5px;
align-items: center;
}
#features div {
margin-bottom: 10px;
}
.icon {
color: #f54f41;
}
#products {
text-align: center;
}
iframe {
margin-top: 10px;
}
#pricing h2 {
text-align: center;
margin-bottom: 8px;
}
#price-grid {
display: grid;
grid-template-columns: 1fr 1fr 1fr;
grid-template-rows: 1fr;
grid-column-gap: 20px;
}
.grid-item {
padding: 10px;
width: 250px;
border: 1px solid #f54f41;
border-radius: 5px;
display: grid;
grid-template-columns: 1fr;
grid-template-rows: 0.3fr 0.3fr 2fr 0.3fr;
justify-items: center;
}
.grid-item h5 {
font-weight: bold;
}
.price {
font-size: 20px;
font-weight: 900;
color: #f54f41;
}
.select-item {
width: 80px;
font-size: 18px;
background: #f54f41;
color: white;
border: none;
border-radius: 5px;
}
.select-item:hover {
cursor: pointer;
box-shadow: 2px 3px 5px #D8D8D8;
}
#footer {
background: #D8D8D8;
padding: 5px;
display: flex;
flex-direction: column;
align-items: flex-end;
}
#footer li {
margin: 0 2px;
list-style: none;
display: inline;
padding-left: 10px;
}
#footer p {
margin: 0;
}
.footer-link {
text-decoration: none;
color: black;
font-weight: bold;
}
Also see: Tab Triggers