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.
<!--Header User stories:
User Story #1: My product landing page should have a header element with a corresponding id="header".
User Story #2: I can see an image within the header element with a corresponding id="header-img". A company logo would make a good image here.
User Story #3: Within the #header element I can see a nav element with a corresponding id="nav-bar".
User Story #4: I can see at least three clickable elements inside the nav element, each with the class nav-link.
User Story #5: When I click a .nav-link button in the nav element, I am taken to the corresponding section of the landing page.
User Story #6: I can watch an embedded product video with id="video".
User Story #7: My landing page has a form element with a corresponding id="form".
User Story #8: Within the form, there is an input field with id="email" where I can enter an email address.
User Story #9: The #email input field should have placeholder text to let the user know what the field is for.
User Story #10: The #email input field uses HTML5 validation to confirm that the entered text is an email address.
User Story #11: Within the form, there is a submit input with a corresponding id="submit".
User Story #12: When I click the #submit element, the email is submitted to a static page (use this mock URL: https://www.freecodecamp.com/email-submit) that confirms the email address was entered and that it posted successfully.
User Story #13: The navbar should always be at the top of the viewport.
User Story #14: My product landing page should have at least one media query.
User Story #15: My product landing page should utilize CSS flexbox at least once.-->
<header id="header">
<div class="header-wrap">
<img id="header-img" src="https://seeklogo.com/images/S/sony-playstation-logo-35A4C2E414-seeklogo.com.png" alt="PS4logo">
<nav id="nav-bar">
<a class="nav-link" href="#header"><button id="navbutton1" class="navbutton" type="button" name="button">About</button></a>
<a class="nav-link" href="#mainfig"><button id="navbutton2" class="navbutton" type="button" name="button">Features</button></a>
<a class="nav-link" href="#colors"><button id="navbutton3" class="navbutton" type="button" name="button">Pricing</button></a>
</nav>
</div>
</header>
<main>
<div id="video-parent-container">
<div id="video-container">
<iframe id="video" width="600" height="300" src="https://www.youtube.com/embed/dtopKmKJ-Zw" frameborder="0" allow="accelerometer; autoplay; encrypted-media; gyroscope; picture-in-picture" allowfullscreen></iframe>
</div>
<div id="about">
<h1>DUALSHOCK®4</h1>
<p>The DUALSHOCK®4 Wireless Controller for PlayStation®4 defines this generation of play, combining revolutionary features and comfort with intuitive, precision controls.
Evolved analog sticks and trigger buttons allow for unparalleled accuracy with every move while innovative technologies offer exciting ways to experience your games and share your greatest moments.</p>
</div>
</div>
<!--key features images and descriptions-->
<div id="key-features">
<figcaption id="mainfig">KEY FEATURES</figcaption>
<figure role="group">
<figure id="image-container">
<figcaption>Precision Control</figcaption>
<img id="image" src="https://media.playstation.com/is/image/SCEA/dualshock-4-precision-triggers-feature-image-01-us-06jun18?$native_md_nt$" alt="Description of image 1">
<p>The feel, shape, and sensitivity of the DUALSHOCK®4’s analog sticks and trigger buttons have been enhanced to offer players absolute control for all games on PlayStation®4 system.</p>
</figure>
<figure id="image-container">
<figcaption>Refined Analog Sticks</figcaption>
<img id="image" src="https://media.playstation.com/is/image/SCEA/dualshock-4-refined-analog-stick-feature-image-01-us-06jun18?$native_md_nt$" alt="Description of image 2">
<p>Improved analog sticks and trigger buttons allow for unparalleled accuracy with every move.</p>
</figure>
<figure id="image-container">
<figcaption>Sharing at Your Fingertips</figcaption>
<img id="image" src="https://media.playstation.com/is/image/SCEA/dualshock-4-touch-pad-feature-image-01-us-06jun18?$native_md_nt$" alt="Description of image 3">
<p>Revolutionary features like the touch pad, integrated light bar, and built-in speaker offer exciting new ways to experience and interact with your games, and the 3.5mm audio jack offers a practical personal audio solution for gamers who want to listen to their games in private.</p>
</figure>
<figure id="image-container">
<figcaption>Refined Analog Sticks</figcaption>
<img id="image" src="https://media.playstation.com/is/image/SCEA/dualshock-4-share-buttonk-feature-image-01-us-06jun18?$native_md_nt$" alt="Description of image 3">
<p>The addition of the Share button makes sharing your greatest gaming moments as easy as a push of a button.
Upload gameplay videos and screenshots directly from your system or live-stream your gameplay, all without disturbing the game in progress.</p>
</figure>
</figure>
</div>
<!--key features images and descriptions-->
<!--colors available-->
<div class="color-heading">
<h3>CHOOSE YOUR COLOR</h3></div>
<div id="colors">
<figure>
<figcaption>MAGMA RED</figcaption>
<p class="price">$38.99</p>
<img src="https://images-na.ssl-images-amazon.com/images/I/81L9%2B4dTIgL._AC_.jpg" alt="MAGMA RED joystick">
</figure>
<figure>
<figcaption>BLUE CAMOUFLAGE</figcaption>
<p class="price">$35.87</p>
<img src="https://images-na.ssl-images-amazon.com/images/I/814h4%2BeRucL.AC_.jpg" alt="BLUE CAMOUFLAGE joystick">
</figure>
<figure>
<figcaption>CRYSTAL</figcaption>
<p class="price">$38.99</p>
<img src="https://images-na.ssl-images-amazon.com/images/I/71uZID%2BEhLL.AC_.jpg" alt="CRYSTAL joystick">
</figure>
<figure>
<figcaption>ELECTRIC PURPLE</figcaption>
<p class="price">$37.04</p>
<img src="https://images-na.ssl-images-amazon.com/images/I/6119pRvfmDL.AC_.jpg" alt="ELECTRIC PURPLE joystick">
</figure>
<figure>
<figcaption>FORTNITE JET BLACK</figcaption>
<p class="price">$38.99</p>
<img src="https://images-na.ssl-images-amazon.com/images/I/81WvQMZv-XL.AC_.jpg" alt="FORTNITE JET BLACK joystick">
</figure>
<figure>
<figcaption>GLACIER WHITE</figcaption>
<p class="price">$38.99</p>
<img src="https://images-na.ssl-images-amazon.com/images/I/719xFB%2Beo6L.AC_.jpg" alt="GLACIER WHITE joystick">
</figure>
<figure>
<figcaption>GOLD</figcaption>
<p class="price">$38.99</p>
<img src="https://images-na.ssl-images-amazon.com/images/I/81ELkUu9omL.AC_.jpg" alt=" GOLD joystick">
</figure>
<figure>
<figcaption>GREEN CAMOUFLAGE</figcaption>
<p class="price">$38.99</p>
<img src="https://images-na.ssl-images-amazon.com/images/I/81n%2BViU1zWL.AC_.jpg" alt="GREEN CAMOUFLAGE joystick">
</figure>
<figure>
<figcaption>RED CAMOUFLAGE</figcaption>
<p class="price">$38.99</p>
<img src="https://images-na.ssl-images-amazon.com/images/I/71Kh7hBk5NL.AC_.jpg" alt="RED CAMOUFLAGE joystick">
</figure>
</div>
<div id="select-color">
<h4>Select your color</h4>
<select>
<option value="0">MAGMA RED</option>
<option value="1">BLUE CAMOUFLAGE</option>
<option value="2">CRYSTAL</option>
<option value="3">ELECTRIC PURPLE</option>
<option value="4">FORTNITE JET BLACK</option>
<option value="5">GLACIER WHITE</option>
<option value="6">GOLD</option>
<option value="7">GREEN CAMOUFLAGE</option>
<option value="8">RED CAMO</option>
</select>
<button id="select" type="submit" name="button">Select</button>
</div>
<!--colors available-->
<form action="https://www.freecodecamp.com/email-submit" id="form" method="post">
<h2>Fortnite Neo Versa DUALSHOCK®4 Wireless Controller Bundle</h2>
<p>The bundle includes Epic Neo Versa Outfit*, Epic Neo Phrenzy Back Bling* and 500 V-Bucks.
*Battle Royale and Creative only. Not accessible in Save the World mode.
Content available in cross platform gameplay. Limited time exclusive through 12/31/2020. Save the World mode not included.
Voucher code valid through 12/31/2020.</p>
<label for="email"></label>
<input type="email" id="email" name="email" placeholder="Enter your email here"><br>
<label for="submit"></label>
<input type="submit" id="submit">
</form>
</main>
<footer id="footer">
<p>Sony Computer Entertainment, Copyright © 2019</p>
</footer>
/*html and body*/
html {
background:url(https://images.unsplash.com/photo-1519326844852-704caea5679e?ixlib=rb-1.2.1&ixid=eyJhcHBfaWQiOjEyMDd9&auto=format&fit=crop&w=1134&q=80) no-repeat center center fixed;
-webkit-background-size: cover;
-moz-background-size: cover;
-o-background-size: cover;
background-size: cover;
background-blend-mode: color;
background-color: rgba(238, 238, 238, 0.31) !important;
}
body {
margin: 0;
padding:0;
}
/*html and body*/
/*header*/
#header {
width: 80%;
margin:auto;
}
.header-wrap {
display: flex;
flex-direction: row;
justify-content: center;
position:fixed;
top:0;
right:0;
left:0;
background-color:#484848;
}
#header-img {
height: 100px;
width:200px;
}
#nav-bar {
align-self: center;
}
.navbutton {
background-image:linear-gradient(150deg, #DF0024, #F3C300);
cursor: pointer;
color: #fff;
font-size:17px;
border-top-color: #DF0024;
border-bottom-color:#00AC9F;
border-right-color:#F3C300;
border-left-color:#2E6DB4;
font-family: 'Odibee Sans', cursive, monospace;
border-style: solid;
border-width: medium;
padding:0.2em;
margin:0.2em;
}
.navbutton:hover {
border-width:thick;
}
.nav-link>.navbutton:hover {
font-size: 21px;
color:#fff;
}
#navbutton1 {
border-bottom-left-radius:10px;
border-top-right-radius:10px;
}
#navbutton2 {
border-radius:10px;
}
#navbutton3 {
border-bottom-right-radius:10px;
border-top-left-radius:10px;
}
/*header*/
/*embed video*/
#video-parent-container {
width: 80%;
margin: auto;
margin-top:20%;
background-color: transparent;
display: flex;
flex-direction: row;
}
#video-container {
width: 90%;
height: 400px;
margin:auto;
}
#video {
display: block;
margin: auto;
width: 100%;
border:5px solid #e6461a;
border-radius:5px;
}
#about {
background-color: transparent;
width: 100%;
box-sizing: border-box;
padding: 2%;
}
#about>h1 {
font-size: 20px;
font-family: 'Odibee Sans', cursive, monospace;
text-align: center;
margin-top: 5%;
color:hsl(180, 60%, 120%);
}
#about>p {
font-family: 'Odibee Sans', cursive, monospace;
font-size: 22px;
font-weight: normal;
text-align: justify;
margin:10px 10px 15px 10px;
color:hsl(180, 60%, 90%);
}
/*embed video*/
/*form*/
#form {
background-color:#6c757d;
width: 50%;
margin: auto;
margin-top: 5%;
text-align: center;
border: 1px solid #e6461a;
border-radius: 10px;
color:#fff;
}
#form>h2 {
font-size: 18px;
text-align: center;
font-family: monospace,sans-serif;
}
#form>p {
font-size: 16px;
font-family: monospace,sans-serif;
margin:10px;
text-align: center;
}
input[type=email] {
text-align:left;
width:60%;
font-family: monospace,sans-serif;
background-color: #ddd;
}
input[type=submit] {
text-align:center;
width:30%;
margin-top:5px;
margin-bottom:5px;
background-color: #e6461a;
color:#fff;
font-family: monospace,sans-serif;
border: 1px solid #e6461a;
border-radius: 10px;
}
/*form*/
/*key features*/
#mainfig {
text-align: center;
font-size: 20px;
font-family: monospace,sans-serif;
color:hsl(180, 60%, 70%);
background-color: #484848;
width: 80%;
margin: auto;
margin-top:5%;
}
figure[role=group] {
background-color: #484848;
display: grid;
grid-template-columns: 1fr 1fr;
grid-gap:1%;
}
#image {
max-width:100%;
width:80%;
height:auto;
border:3px solid #e6461a;
}
#image-container {
background-color: transparent;
text-align: center;
font-size: 16px;
font-family: monospace,sans-serif;
color:hsl(180, 60%, 70%);
box-sizing: border-box;
padding:2%;
}
#image-container>figcaption {
font-size: 20px;
margin:5% auto 5% auto;
}
#image-container>p {
padding:10px;
}
/* key feature*/
/*colors available*/
#colors{
display: grid;
grid-template-columns: 1fr 1fr 1fr;
grid-template-rows: 1fr 1fr 1fr;
background-color: transparent;
text-align: center;
}
.price {
font-size: 14px;
color:#fcfaea;
}
#colors>figure>img {
max-width:;
width:60%;
height:auto;
border:1px solid #e6461a;
cursor: pointer;
}
#colors>figure>figcaption {
font-size: 16px;
font-family: monospace,sans-serif;
color:hsl(180, 60%, 70%);
text-align: center;
margin-bottom: 5px;
}
.color-heading {
font-size: 16px;
font-family: monospace,sans-serif;
color:hsl(180, 60%, 70%);
text-align: center;
margin-top:5%;
}
#select-color {
text-align: center;
font-family: monospace,sans-serif;
color:hsl(180, 60%, 70%);
}
#select-color>#select {
text-align:center;
width:20%;
margin-top:5px;
margin-bottom:5px;
background-color: #e6461a;
color:#fff;
font-family: monospace,sans-serif;
border: 1px solid #e6461a;
border-radius: 10px;
}
select {
background-color:#FFF;
}
/*colors available*/
/*footer*/
#footer {
background-color: #484848;
padding:25px;
font-size: 20px;
font-family: 'Odibee Sans', cursive, monospace;
text-align: center;
margin-top: 5%;
color:hsl(180, 60%, 120%);
}
/*footer*/
@media(max-width:1111px) {
#video-parent-container {
display: block;
width: 100%;
text-align: center;
}
}
@media(max-width:853px){
figure[role=group] {
display: block;
width: 80%;
margin: auto;
}
}
@media(max-width:760px) {
#image-container {
font-size:12px;
}
}
@media(max-width:760px) {
#image-container>figcaption {
font-size:17px;
}
}
@media(max-width:760px) {
#colors {
display: block;
width: 80%;
margin:auto;
text-align: center;
}
}
@media(max-width:760px) {
#colors>figure>figcaption {
font-size:12px;
}
}
@media(max-width:760px) {
#select-color>#select, select {
font-size: 12px;
}
}
@media(max-width:760px) {
#video-container {
width: 60%;
margin:auto;
}
}
@media(max-width:768px){
#header-img, .navbutton, .nav-link{
transform: scale(0.7);
margin:0;
padding:0.3em;
font-size:13px;
}
}
@media(max-width:768px){
#header-img {
height: 50px;
width:100px;
}
}
@media(max-width:768px) {
#header {
height: 20%;
display: flex;
}
}
Also see: Tab Triggers