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.
<html lang="en">
<head>
<meta charset="UTF-8">
<meta http-equiv="X-UA-Compatible" content="IE=edge">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<title>Product Landing Page</title>
<link rel="stylesheet" href="style2.css">
</head>
<body>
<main id="container">
<section class="sect-1">
<header id="header">
<div id="sub-head">
<img src="#" id="header-img">
<span></span>
<nav id="nav-bar">
<ul id="ul">
<li class="li"><a href="#home-div" class="nav-link">Home</a></li>
<li class="li"><a href="#contact-div" class="nav-link">Contact Us</a></li>
<li class="li"><a href="#guide-div" class="nav-link">Guide</a></li>
</ul>
</nav>
</div>
</header>
</section>
<section class="sect-2">
<div id="home-div">
<div id="desc-heading">
<h1>Who We Are</h1>
<p>Lorem ipsum dolor sit amet consectetur adipisicing elit. Tempora et autem sunt veniam debitis
fugiat
veritatis </p>
</div>
<ul>
<li>
<h3>Big Title Heading</h3>
<p>Lorem ipsum dolor sit amet consectetur adipisicing elit. Tenetur dolore architecto quod
debitis
placeat ex harum, vitae deserunt </p>
</li>
<li>
<h3>Big Title Heading</h3>
<p>Lorem ipsum dolor sit amet consectetur adipisicing elit. Tenetur dolore architecto quod
debitis
placeat ex harum, vitae deserunt </p>
</li>
<li>
<h3>Big Title Heading</h3>
<p>Lorem ipsum dolor sit amet consectetur adipisicing elit. Tenetur dolore architecto quod
debitis
placeat ex harum, vitae deserunt </p>
</li>
</ul>
</div>
<div id="contact-div">
<form id="form" action="https://www.freecodecamp.com/email-submit" target="_blank" method="GET">
<label for="#"> Signup to our Newsletter
<input id="email" type="email" placeholder="Email address..." name="email" required>
</label>
<input type="submit" id="submit">
</form>
</div>
<div id="guide-div">
<iframe src="https://www.youtube.com/embed/wfaDzSL6ll0" title="YouTube video player" frameborder="0"
allow="accelerometer; autoplay; clipboard-write; encrypted-media; gyroscope; picture-in-picture"
allowfullscreen id="video">If you can"t play this video then you will need a modern browser that
support
video playing. Please switch to a modern browser 😉😊</iframe>
</div>
</section>
<section class="sect-3">
<footer id="footer">
<p>Copyright © 2021 Company Name</p>
<p>Designed and Developed by <span>@Danny_DOC</span></p>
</footer>
</section>
</main>
</body>
</html>
/** Global Styles **/
:root {
font-family: "Inter";
font-size: 16px;
--bg-primary: #bf0f03;
--bg-secondary: #5e0000;
--bg-primary-lightshade: #FA5031;
--font-fg: #ffb5b5;
--body-padding: 20px;
--input-valid-border: #005e00;
scroll-behavior: smooth;
}
* {
padding: 0;
margin: 0;
}
body {
background: var(--bg-primary);
max-width: 100vw;
display: flex;
justify-content: center;
padding: var(--body-padding) 0;
}
main#container {
height: 100vh;
display: grid;
grid-template-rows: auto 1fr auto;
grid-template-columns: 95vw;
grid-row-gap: 10px;
}
/** Header Section Styles **/
#header {
position: fixed;
top: 0;
left: 0;
padding: 20px;
margin-bottom: 60px;
}
#sub-head {
/* width: 90%; */
padding: 20px;
display: grid;
grid-template-columns: 1fr 2fr 3fr;
background: var(--bg-secondary);
border-radius: 50px;
box-shadow: 0 4px 10px rgba(0, 0, 0, 0.468);
}
#nav-bar {
display: grid;
grid-template-columns: 100%;
align-items: center;
}
#nav-bar ul {
width: 100%;
display: grid;
grid-column-gap: 10px;
grid-template-columns: 1fr 1fr 1fr;
justify-items: center;
}
.li {
list-style: none;
}
.li a {
text-decoration: none;
color: #fff;
font-size: 1.2rem;
letter-spacing: 1px;
}
.li a:hover {
color: var(--font-fg);
}
/** Content Section Styles **/
.sect-2 {
display: grid;
justify-content: center;
grid-template-columns: 55% 40%;
grid-template-rows: 55% 40%;
grid-gap: 20px;
padding: 10px 0;
margin-top: 50px;
}
.sect-2 > div {
background: var(--bg-primary-lightshade);
padding: 30px;
border-radius: 20px;
box-shadow: 0 4px 15px rgba(0,0,0,0.25);
}
/** Home Div Styles **/
#home-div {
grid-area: 1/1/3/2;
display: grid;
grid-template-rows: auto 1fr;
grid-row-gap: 10px;
justify-content: flex-start;
}
#desc-heading {
margin: 20px 0;
}
#desc-heading h1 {
font-size: 2.5rem;
margin-bottom: 10px;
}
#home-div ul li {
list-style: none;
margin-bottom: 20px;
}
/** Contact Div Style **/
#contact-div {
grid-area: 1/2/2/2;
display: flex;
justify-content: center;
}
#form {
width: 100%;
display: flex;
flex-direction: column;
justify-content: space-evenly;
align-items: center;
}
#form label {
font-size: 1.5rem;
font-weight: 500;
display: flex;
flex-direction: column;
justify-content: space-around;
align-items: center;
height: 50%;
width: 100%;
text-align: center;
}
#email {
width: 100%;
height: 40px;
padding: 20px;
outline: none;
border: none;
border-radius: 20px;
font-family: "Maven Pro";
transition: 0.5s ease;
}
#email:focus:invalid {
box-shadow: inset 0 0 0 2px var(--bg-primary);
}
#email:focus:valid {
box-shadow: inset 0 0 0 2px var(--input-valid-border);
}
#submit {
width: 8rem;
height: 3rem;
font-size: 1.2rem;
border: none;
border-radius: 20px;
background: var(--bg-secondary);
color: #fff;
transition: 0.2s ease;
}
#submit:hover {
background: var(--bg-primary);
}
/** Guide Div Styles **/
#guide-div {
grid-area: 2/2/3/3;
padding: 0;
display: flex;
justify-content: center;
overflow: hidden;
}
iframe {
width: 100%;
height: 100%;
}
/** Footer Section Style **/
.sect-3 {
display: grid;
grid-template-columns: 100%;
}
#footer {
background: var(--bg-secondary);
padding: 25px 50px;
border-radius: 50px;
align-items: flex-end;
color: #fff;
}
#footer p {
letter-spacing: 0.7px;
font-weight: 400;
margin-bottom: 10px;
}
#footer p:nth-of-type(2) {
color: rgb(255, 193, 193);
font-weight: 500;
font-size: 1.2rem;
letter-spacing: 0.7px;
line-height: 30px;
margin-bottom: 0 !important;
}
#footer p span {
background: var(--bg-primary-lightshade);
padding: 5px;
color: var(--bg-secondary);
border-radius: 5px;
}
/** Media Queries and Mobile Design **/
@media (max-width: 800px) {
/** Mobile Header Section Styles **/
#sub-head {
grid-template-columns: 100% !important;
justify-items: center;
box-shadow: 0 4px 10px rgba(0, 0, 0, 0.461);
}
#sub-head img, #sub-head span {
display: none;
}
#nav-bar {
width: 100%;
}
#nav-bar ul {
justify-items: center;
}
.li a{
font-size: 1.1rem;
}
/** Mobile Content Section Styles **/
.sect-2 {
grid-template-columns: 100%;
grid-template-rows: 4.5fr 2.5fr 3fr;
}
#home-div {
grid-area: 1/1/2/2;
}
#contact-div {
grid-area: 2/1/3/2;
}
#email {
height: 30px;
}
#guide-div {
grid-area: 3/1/4/2;
}
/** Mobile Footer Section Styles **/
footer {
text-align: center;
}
footer h3 {
font-size: 1.2rem;
}
}
// !! 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