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.
<script src="https://cdn.freecodecamp.org/testable-projects-fcc/v1/bundle.js"></script>
<link
rel="stylesheet"
href="https://use.fontawesome.com/releases/v5.8.1/css/all.css"
integrity="sha384-50oBUHEmvpQ+1lW4y57PTFmhCaXp0ML5d60M1M7uH2+nqUivzIebhndOJK28anvf"
crossorigin="anonymous"
/>
<header id="header">
<div class="logo">
<img
id="header-img"
src="https://i.imgur.com/Fk7mB91.png"
alt="hair care logo"
>
</div>
<nav id="nav-bar">
<ul>
<li><a class="nav-link" href="#about">About</a></li>
<li><a class="nav-link" href="#features">Features</a></li>
<li><a class="nav-link" href="#how-it-works">How it works</a></li>
</ul>
</nav>
</header>
<article id="about" class="heading-container">
<div class="heading-photo">
<img
src="https://i.imgur.com/0k5PIhq.png"
alt="header illustration">
</div>
<div>
<h1 id="heading">Embrace your <br> natural hair.</h1>
<h3 id="description">Natural products made for you</h3>
<form id="form" action="https://www.freecodecamp.com/email-submit">
<input
name="email"
id="email"
type="email"
placeholder="Enter your email address"
required
>
<input id="submit" type="submit" value="Get Started" class="button">
</form>
</div>
</article>
<article id="features">
<h1 class="large-title">Our products are:</h1>
<section class="grid-container">
<div class="short-paragraph">
<div class="icon"><i class="fas fa-heart fa-7x"></i></div>
<h3 class="small-title">Cruelty free</h3>
<p>Lorem ipsum dolor sit amet consectetur adipiscing elit. Class mauris nibh ultrices eget senectus cubilia turpis aliquam facilisis</p>
</div>
<div class="short-paragraph">
<div class="icon"><i class="fab fa-envira fa-7x"></i></div>
<h3 class="small-title">Silicone free</h3>
<p>Lorem ipsum dolor sit amet consectetur adipiscing elit. Class mauris nibh ultrices eget senectus cubilia turpis aliquam facilisis</p>
</div>
<div class="short-paragraph">
<div class="icon"><i class="fas fa-users fa-7x"></i></div>
<h3 class="small-title">Tested by hundreds</h3>
<p>Lorem ipsum dolor sit amet consectetur adipiscing elit. Class mauris nibh ultrices eget senectus cubilia turpis aliquam facilisis</p>
</div>
</section>
</article>
<article id="how-it-works">
<div class="grid-container">
<iframe
id="video"
class="resp-container"
width="560"
height="315"
src="https://www.youtube.com/embed/UG-CMivSZaU"
frameborder="0"
allow="accelerometer; autoplay; clipboard-write; encrypted-media; gyroscope; picture-in-picture"
allowfullscreen></iframe>
<div class="long-paragraph">
<h1 class="large-title">Watch them work</h1>
<p class="adjust">Habitant aptent nam sollicitudin vestibulum viverra nisi etiam iaculis vivamus, porttitor taciti facilisis ante tincidunt mattis malesuada penatibus posuere, lobortis sed mus feugiat id ridiculus ultricies integer.</p>
</div>
</div>
</article>
<footer>
<h4>Made with ❤ by Maru</h4>
</footer>
/* Body font */
@import url('https://fonts.googleapis.com/css2?family=Montserrat&display=swap');
/* Headings font */
@import url('https://fonts.googleapis.com/css2?family=Montserrat&family=Poppins:wght@700&display=swap');
body {
font-family: 'Montserrat', sans-serif;
line-height: 1.3;
margin: 0;
background-color: #FFF6BB;
color: #473508;
}
/* Navigation Bar */
#nav-bar {
color: white;
text-align: right;
}
@media (max-width: 700px) {
#nav-bar {
text-align: center;
}
}
li {
display: inline;
font-size: 14px;
margin: 2em;
}
@media (max-width: 700px) {
li {margin: 1em;}
}
a {
text-decoration: none;
font-family: inherit;
color: inherit;
}
#header { /* Nav Bar Container */
position: fixed;
top: 0;
display: flex;
justify-content: space-around;
align-items: center;
background-color: #473508;
width: 100%;
height: auto;
}
.logo > img {
width: 100%;
height: auto;
max-width: 10vw;
padding-top: 0.30em;
}
@media (max-width: 900px) {
.logo > img {
max-width: 15vw;
}
}
/* About Section */
#heading { /* Main Title */
font-family: 'Poppins', sans-serif;
color: #D86348;
font-size: 3em;
margin-bottom: 0.30em;
}
@media (max-width: 700px) {
#heading {margin-top: 1.5em;}
}
.heading-container { /* About Section Container */
display: flex;
justify-content: space-evenly;
flex-direction: row-reverse;
align-items: center;
width: 100%;
min-height: 100vh;
}
@media (max-width: 700px) {
.heading-container {
flex-direction: column-reverse;
text-align: center;
}
}
.heading-photo > img {
width: 100%;
height: auto;
max-width: 35vw;
margin-top: 2em;
}
@media (max-width: 700px) {
.heading-photo > img {
max-width: 40vw;
margin: 0;
}
}
/* Form */
input {
font-family: inherit;
font-size: inherit;
padding: 0.60em;
border: none;
}
.button {
border: none;
background-color: #EFA23C;
color: inherit;
border-radius: 2px;
padding: 0.60em;
font-weight: bold;
}
/* Features and How it works Sections */
.grid-container { /* Main Container */
width: 100%;
display: flex;
justify-content: space-evenly;
min-height: 65vh;
margin-bottom: 1em;
}
@media (max-width: 700px) { /* This will adjust the features section*/
.grid-container {
flex-direction: column;
align-items: center;
}
}
#features { /* To adjust the jumping thing */
padding-top: 1.5em;
}
.short-paragraph {
max-width: 22vw;
text-align: center;
}
@media (max-width: 700px) {
.short-paragraph {
max-width: 70vw;
margin-bottom: 0.30em;
}
}
.icon {
color: #776630;
}
.small-title {
font-family: 'Poppins', sans-serif;
color: #D86348;;
font-size: 1.3em;
}
.large-title {
font-family: 'Poppins', sans-serif;
color: #D86348;
font-size: 3em;
text-align: center;
}
.long-paragraph {
max-width: 45vw;
text-align: center;
}
@media (max-width: 900px) {
.long-paragraph {
max-width: 80vw;
}
}
@media (max-width: 900px) {
#how-it-works .grid-container { /* This will adjust the how-it-works section*/
flex-direction: column;
align-items: center;
}
}
/* Footer */
footer {
color: white;
background-color: #473508;
text-align: center;
height: auto;
padding: 5px 0 5px 0;
font-weight: lighter;
}
h4 {
font-weight: lighter;
}
Also see: Tab Triggers