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.
<header id="header">
<img
id="header-img"
src="https://cdn2.vectorstock.com/i/1000x1000/31/71/tree-of-life-logo-vector-24033171.jpg";
alt="thumbnail"/>
<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="#video">Video</a></li>
</ul>
</nav>
</header>
<section class="hero">
<div class="background-image"></div>
<div class="hero-content-area">
<h1>Enjoy products free from chemicals </h1>
<h3>Our mission is to create products from locally sourced organic ingredients</h3>
<a href="#contact" class="btn">Contact Us Now</a>
</div>
</section>
<div class="container"/>
<section id="hero">
<h2>Stay up-to-date with what we're doing!</h2>
<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="btn" />
</form>
</section>
<div class="container">
<section id="about">
<div class="grid">
<div class="icon"><i class="fa fa-address-card"></i></div>
<div class="desc">
<h2>About</h2>
<p>
We are a small based business in North Dakota who rely on the medicinal plants of the region to help aid with home remedies.
</p>
</div>
</div>
<section id="features">
<div class="grid">
<div class="icon"><i class="fa fa-bacterium"></i></div>
<div class="desc">
<h2>Features</h2>
<p>We offer various different kinds of remedies for all ailments</p>
</div>
</div>
<div class="grid">
<div class="icon"><i class="fa fa-air-freshener"></i></div>
<div class="desc">
<h2>Video</h2>
<p>Check out our latest videos</p>
</div>
</div>
<iframe id="video"
width="1000"
height="500"
src="https://www.youtube.com/embed/WhOrIUlrnPo"
title="YouTube video player"
frameborder="0"
allow="accelerometer; autoplay; clipboard-write; encrypted-media; gyroscope; picture-in-picture"
allowfullscreen>
</iframe>
</section>
<footer>
<ul>
<li><a href="#"Privacy/></li>
<li><a href="#"Terms/></li>
<li><a href="#"Contract/></li>
/*General Styles*/
@import url('https://fonts.googleapis.com/css2?family=Lobster&display=swap');
* {
margin: 0;
padding: 0;
box-sizing: border-box;
}
html {
font-size: 16px;
font-family: "Lobster", sans-serif;
color: #555;
}
ul,
nav {
list-style: none;
}
a {
text-decoration: none;
opacity: 0.75;
color: black;
}
a:hover {
opacity: 1;
}
a.btn {
border-radius: 4px;
text-transform: uppercase;
font-weight: bold;
text-align: center;
background-color: #e07e7b;
opacity: 1;
transition: all 400ms;
}
a.btn:hover {
background-color: #ce5856;
}
section {
display: flex;
flex-direction: column;
align-items: center;
padding: 100px 80px;
}
section:not(.hero):nth-child(even) {
background-color: #f5f5f5;
}
.grid {
width: 100%;
display: flex;
flex-wrap: wrap;
justify-content: center;
}
hr {
width: 250px;
height: 3px;
background-color: #e07e7b;
border: 0;
margin-bottom: 50px;
}
section h3.title {
text-transform: capitalize;
font: bold 48px "Lobster", sans-serif;
margin-bottom: 30px;
text-align: center;
}
section p {
max-width: 775px;
line-height: 2;
padding: 0 20px;
margin-bottom: 30px;
text-align: center;
}
@media (max-width: 800px) {
section {
padding: 50px 20px;
}
}
/*Header Styles*/
header {
position: fixed;
width: 100%;
display: flex;
justify-content: space-between;
align-items: center;
padding: 35px 100px 0;
animation: 1s fadein 0.5s forwards;
opacity: 0;
color: black;
z-index: 2;
}
@keyframes fadein {
100% {
opacity: 1;
}
}
header h2 {
font-family: "Lobster", sans-serif;
}
header nav {
display: flex;
margin-right: -15px;
}
header nav li {
margin: 0 15px;
justify-content: center;
}
@media (max-width: 800px) {
header {
padding: 20px 50px;
flex-direction: column;
}
header h2 {
margin-bottom: 15px;
}
}
/*Hero Styles*/
.hero {
position: relative;
justify-content: center;
text-align: center;
min-height: 100vh;
color: #fff;
}
img{
height:300px;
position: auto;
}
.hero .background-image {
position: absolute;
top: 0;
left: 0;
width: 100%;
height: 100%;
background-image: url("https://images.unsplash.com/photo-1505535162959-9bbcb4ab22d6?ixlib=rb-0.3.5&q=80&fm=jpg&crop=entropy&cs=tinysrgb&w=1600&h=900&fit=crop&s=2feeaf89ad55829f92c4bbc6ca8e83ce");
background-size: cover;
z-index: -1;
background-color: #80a3db;
}
.hero h1 {
font: 72px "Lobster", sans-serif;
text-shadow: 2px 2px rgba(0, 0, 0, 0.3);
margin-bottom: 15px;
}
.hero h3 {
font: 28px "Lobster", sans-serif;
font-weight: 300;
text-shadow: 2px 2px rgba(0, 0, 0, 0.3);
margin-bottom: 40px;
}
.hero a.btn {
padding: 20px 46px;
}
.hero-content-area {
opacity: 0;
margin-top: 100px;
animation: 1s slidefade 1s forwards;
}
@keyframes slidefade {
100% {
opacity: 1;
margin: 0;
}
}
@media (max-width: 800px) {
.hero {
min-height: 600px;
}
.hero h1 {
font-size: 48px;
}
.hero h3 {
font-size: 24px;
}
.hero a.btn {
padding: 15px 40px;
}
}
.container{
text-align:center;
box-shadow:2px 2px (0 0 0.3);
}
.products .grid li {
height: 250px;
padding: 20px;
background-clip: content-box;
background-size: cover;
background-position: center;
text-align: center;
margin:20px;
}
.products .grid li.small {
flex-basis: 30%;
text-align: center;
}
.products .grid li.large {
flex-basis: 70%;
text-align: center;
}
@media (max-width: 1100px) {
.products .grid li.small,
.products .grid li.large {
flex-basis: 50%;
text-align: center;
}
}
@media (max-width: 800px) {
.products .grid li.small,
.products .grid li.large {
flex-basis: 100%;
text-align: center;
}
}
/*Packages Section*/
.art .grid li {
padding: 50px;
flex-basis: 50%;
text-align: center;
}
.art .grid li i {
color: #e07e7b;
}
.art .grid li h4 {
font-size: 30px;
margin: 25px 0;
}
@media (max-width: 800px) {
.art .grid li {
flex-basis: 100%;
padding: 20px;
}
}#hero {
display: flex;
flex-direction: column;
align-items: center;
justify-content: center;
text-align: center;
height: 200px;
margin-top: 50px;
}
#hero > h2 {
margin-bottom: 20px;
word-wrap: break-word;
}
#hero input[type='email'] {
max-width: 275px;
width: 100%;
padding: 5px;
}
#hero input[type='submit'] {
max-width: 150px;
width: 100%;
height: 30px;
margin: 15px 0;
border: 0;
background-color: #f1c40f;
}
#hero input[type='submit']:hover {
background-color: orange;
transition: background-color 1s;
}
/*Contact Section*/
.contact form {
display: flex;
align-items: center;
justify-content: center;
flex-wrap: wrap;
width: 60%;
}
.contact form .btn {
padding: 18px 42px;
}
.contact form input {
padding: 15px;
margin-right: 30px;
font-size: 18px;
color: #555;
flex: 1;
}
@media (max-width: 1000px) {
.contact form input {
flex-basis: 100%;
margin: 0 0 20px 0;
}
}
#video {
margin-top: 50px;
display: flex;
justify-content: center;
}
#video > iframe {
max-width: 1280px;
width: 720px;
}
/*Footer Section*/
footer {
display: flex;
align-items: center;
justify-content: space-around;
background-color: #555;
color: #fff;
padding: 20px 0;
}
footer ul {
display: flex;
}
footer ul li {
margin-left: 16px;
}
footer p {
text-transform: uppercase;
font-size: 14px;
opacity: 0.6;
align-self: center;
}
@media (max-width: 1100px) {
footer {
flex-direction: column;
}
footer p {
text-align: center;
margin-bottom: 20px;
}
footer ul li {
margin: 0 8px;
}
}
// !! 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