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 URL's 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 it's URL and the proper URL extention.
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 Skypack, which makes packages from npm not only available on a CDN, but prepares them for native JavaScript ES6 import
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.
<main>
<header id="header">
<img id="header-img" src="https://i.imgur.com/Hf7sSE7.png" alt="crinkle monster logo">
<nav id="nav-bar">
<ul>
<li><a href="#shop" class="nav-link">shop</a></li>
<li><a href="#action" class="nav-link">crinkle monster in action</a></li>
<li><a href="#about-us" class="nav-link">why it works</a></li></ul>
</nav>
</header>
<article id="about">
<h1>Crinkle Monster: the World's Best Cat Toy!</h1>
<h2> Stop buying expensive toys your cat loses or gets bored with after one day.</h2>
<h2>Switch to a fun, recyclable, CRINKLY solution that will have them coming back again and again.</h2>
<img class="product-img" src="https://i.imgur.com/E6GfTBt.jpg" alt="pale-skinned hands lifting a crinkly piece of brown paper from a box">
</article>
<h3>Shop</h3>
<div id="shop" class="products">
<div id="shopbox1" class="shopbox">
<h3 class="productname">Crinkle Starter Kit</h3>
<p class="price">$10</p>
<p>3 Crinkle Monsters: A perfect starter kit for your cat's next adventure.</p>
<button class="buy">Buy</button>
<p><button class="learn">Learn More</button></p>
</div>
<div id="shopbox2" class="shopbox">
<h3 class="productname">Multi-Cat Crinkles</h3>
<p class="price">$30</p>
<p>10 Crinkle Monsters: Buy in bulk for many paws & a happy cat family!</p>
<button class="buy">Buy</button>
<p><button class="learn">Learn More</button></p>
</div>
<div id="shopbox3" class="shopbox">
<h3 class="productname">Crinkles Forever</h3>
<p class="price">Starting at $8/Month</p>
<p>3 fresh Crinkle Monsters delivered to your doorstep every month.</p>
<p><button class="buy">Sign Up</button></p>
<p><button class="learn">Learn More</button></p>
</div>
</div>
<h3>Crinkle Monster in action!</h3>
<div id="action">
<iframe width="420" height="315" id="video"
src="https://www.youtube.com/embed/VK7rOnbcDws">
</iframe>
</div>
<div id="about-us">
<h3>Why It Works</h3>
<p>"Your cat has absolutely amazing hearing and can actually hear at the ultrasonic level. While cats don’t use this superhuman level of hearing to communicate with each other, mice certainly do! The noise that crinkling up that piece of paper makes could not only mimic the ultrasonic communication of mice but it could also sound similar to the movement of mice and other small animals in the bushes and leaves." </p>
<p><a href="https://betterwithcats.net/why-do-cats-like-crinkly-things/"> - <em>Better With Cats</em> Blog</a> </p>
<img class="product-img" src="https://i.imgur.com/wsSQMka.png" alt="long piece of brown crinkled paper">
</div>
</main>
<footer>
<div id="newsletter">
<h2>Get your paws on our newsletter for a meowtastic discount!</h2>
<form id="form" action="https://www.freecodecamp.org/email-submit">
<label for="email">Your Email:</label>
<input id="email" type="email" placeholder="crinkle@crinklecats.com" name="email" class="learn" required>
<button id="submit" type="submit" class="learn">Sign me up</button>
</form></div>
<p>Copyright 2022 - Crinkle Monster LLC</p>
</footer>
main {
text-align: center;
padding: 8vmax;
background-image: url("https://www.transparenttextures.com/patterns/exclusive-paper.png");
}
main, footer, nav {
font-family: helvetica, sans-serif;
}
h1, h3, .price {
font-family: "caveat brush", handwriting;
}
h1 {
font-size: 45px;
}
h2 {
font-size: 22px;
}
h3 {
font-size: 35px;
text-transform: uppercase;
}
#header-img {
position: relative;
width: 100px;
max-width: 50%;
border-radius: 50px;
}
.product-img {
width: 400px;
border-radius: 10px;
max-width: 60%;
height: auto;
padding: 5px;
}
#header {
padding: 10px;
position: fixed;
display: flex;
justify-content: space-around;
flex-wrap: wrap;
width: 100%;
top: 0;
left: 0;
background-color: #6E4139;
}
#nav-bar {
padding-top: 10px;
margin: 1vw;
}
nav li {
display: inline;
}
.nav-link {
padding: 10px;
text-transform: uppercase;
color: white;
}
a:hover {
color: #5271FF;
font-weight: 600;
}
#about {
margin-top: 15vh;
}
#shop {
display: flex;
justify-content: space-around;
flex-wrap: wrap;
gap: 10px;
}
.shopbox {
width: 300px;
height: auto;
border-radius: 5px;
background-color: #FFFAEB;
padding: 10px;
}
.productname {
font-size: 20px;
font-style: italic;
}
.price {
font-size: 18px;
}
.buy, #submit {
border-radius: 7px;
border: 1px solid;
background: #5271FF;
color: white;
text-transform: uppercase;
font-weight: 900;
padding: 5px;
}
.learn {
border: 2px solid;
color: #5271ff;
font-weight: 800;
border-radius: 5px;
padding: 5px;
}
#about-us {
background-color: #FFFAEB;
padding: 2px 40px;
margin-top: 10px;
margin-left: auto;
margin-right: auto;
max-width: 600px;
border-radius: 10px;
}
form {
text-align: center;
padding: 10px;
max-width: 100%;
margin: auto;
}
#newsletter {
display: flex;
align-items: center;
background-color: #FFFAEB;
padding: 20px;
margin: auto;
border-radius: 5px;
max-width: 800px;
}
#submit {
margin-top: 10px;
}
footer {
text-align: center;
padding: 30px;
background: #6E4139;
}
footer p {
color: white;
}
@media screen and(max-width: 767px) {
main {
padding: 20vmax 10vmin;
}
iframe {
width: 80%;
}
#header, #newsletter {
flex-direction: column;
align-items: center;
}
#nav-bar {
padding-right: 10vw;
}
}
@media (max-width: 625px) {
#header {
padding-bottom: 0px;
}
#about {
margin-top: 25vh;
}
h1 {
font-size: 30px;
}
h2 {
font-size: 20px;
}
h3 {
font-size: 25px;
}
}
// !! IMPORTANT README:
// You may add additional external JS and CSS as needed to complete the project, however the current external resource MUST remain in place for the tests to work. BABEL must also be left in place.
/***********
INSTRUCTIONS:
- Select the project you would
like to complete from the dropdown
menu.
- Click the "RUN TESTS" button to
run the tests against the blank
pen.
- Click the "TESTS" button to see
the individual test cases.
(should all be failing at first)
- Start coding! As you fulfill each
test case, you will see them go
from red to green.
- As you start to build out your
project, when tests are failing,
you should get helpful errors
along the way!
************/
// PLEASE NOTE: Adding global style rules using the * selector, or by adding rules to body {..} or html {..}, or to all elements within body or html, i.e. h1 {..}, has the potential to pollute the test suite's CSS. Try adding: * { color: red }, for a quick example!
// Once you have read the above messages, you can delete all comments.
Also see: Tab Triggers