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.
<body>
<header id="header">
<nav id="nav-bar" class="navbar">
<img id="header-img" src="https://i.postimg.cc/1tsLz4W8/logo.png">
<a href="#" class="toggle-button">
<span class="bar"></span>
<span class="bar"></span>
<span class="bar"></span>
</a>
<div class="navbar-links">
<ul>
<li><a class="nav-link" href="#home">Home</a></li>
<li><a class="nav-link" href="#controller">Controller</a></li>
<li><a class="nav-link" href="#specs">Specs</a></li>
<li><a class="nav-link" href="#overview">Overview</a></li>
<li><a class="nav-link" href="#games">Games</a></li>
</ul>
</div>
</nav>
</header>
<section id="home">
<img id="image1" src="https://i.postimg.cc/76Z82Lpq/CITYPNG-COM-Console-Of-Xbox-Series-X-With-Controller-891x1088.png">
<div id="product-info">
<h1 id="title"><b>Xbox<br>Series X</b></h1>
<p id="info">
The Fastest,<br> Most Powerful Xbox Ever
</p>
<button id="buy">Buy</button>
</div>
</section>
<section id="controller">
<h1 id="heading1">Complete <br><span>Control</span></h1>
<img id="image2" src="https://i.postimg.cc/L6vbS0Z9/CITYPNG-COM-Controller-Of-Microsoft-Xbox-Series-X-1920x1080-1.png">
<h3 id="title2">FINE-TUNED PERFORMANCE</h3>
<p id="info2">The Xbox Wireless Controller brings elegant design, refined comfort and instant sharing to a familiar favourite</p>
<a class="link1" href="https://www.xbox.com/en-IN/accessories/controllers/xbox-wireless-controller" target="_blank"><span>Controller Details</span></a>
</section>
<section id="specs">
<div id="container">
<div class="card">
<img src="https://i.postimg.cc/L8V0c0Q2/xbox-series-x-board-2.jpg" alt="">
<h2><span>SPLIT MOTHERBOARD</span></h2>
<p class="spec">
A split motherboard keeps the console’s internals evenly temperature controlled allowing for an even higher output of power.
</p>
</div>
<div class="card">
<img src="https://i.postimg.cc/mkMm8dFx/xbox-series-x-vapor-chamber.jpg" alt="">
<h2><span>VAPOUR CHAMBER</span></h2>
<p class="spec">
The vapour chamber in the Xbox Series X enables an even spread of temperatures within the core.
</p>
</div>
<div class="card">
<img src="https://i.postimg.cc/NF71KZH0/xbox-series-x-tech-chassis.jpg" alt="">
<h2>
<span>HEAT-SINK</span>
</h2>
<p class="spec">
A heat-sink chassis is a unique, non-electronic component that merges parallel cooling with unique design to increase the reliability of performance.
</p>
</div>
</div>
</section>
<section id="overview">
<div id="container1">
<img id="logo" src="https://i.postimg.cc/hvrYHL62/edd726a9-d648-4864-9863-c0f8d6b4fa00.png" alt="">
<img id="image4" src="https://i.postimg.cc/4yh9HVHj/ezgif-com-gif-maker.gif">
<h1 id="headline2">ENGINEERED <br> FOR <span>SPEED</span></h1>
<p id="info4">
Together, the new system on a chip (SOC) and the Xbox Velocity Architecture put speed at your fingertips, and the 1TB custom SSD & CPU put the wheel in your hands, so you can go from 0-60 in up to 120FPS.
</p>
</div>
<div id="container2">
<p id="info5">
<span>Faster load times</span>. Sip quick. Games load significantly faster with the custom SSD in the Xbox Series X.
</p>
<iframe id="video" src="https://www.microsoft.com/en-IN/videoplayer/embed/RE4rH35?autoplay=true" frameborder="0"></iframe>
<p id="info6"><span>Change the game.</span> With Quick Resume, you can seamlessly switch between multiple different titles and resume instantly from where you left off.</p>
</div>
</section>
<section id="games">
<div id="container3">
<img id="image5" src="https://i.postimg.cc/C1pQsLm7/bb79c80c-4682-4463-965e-59a986783238.jpg" alt="">
<img id="image6" src="https://i.postimg.cc/C5mr0CYr/bec81a1f-0bce-4f78-b8e2-b5a49a4a37ec.jpg" alt="">
<img id="image7" src="https://i.postimg.cc/3xyfMDq9/7ac64cff-f54d-49aa-a5c6-7fd2b224903e.jpg" alt="">
<img id="image8" src="https://i.postimg.cc/Zqpfnz4d/49eb5848-10f8-482c-8fed-f496ea7f8afe.jpg" alt="">
</div>
<div id="container4">
<h1 id="headline3">INSTANT<br>
<span>LIBRARY</span></h1>
<p id="info7">Discover your next favourite game. Access over 100 high-quality games, plus get all the benefits of Xbox Live Gold and EA Play when you subscribe to Xbox Game Pass Ultimate.</p>
<a class="link2" href="https://www.xbox.com/en-IN/xbox-game-pass"><span>Learn More</span></a>
</div>
</section>
<footer>
<h1>Get access to the exculsive <span>updates</span></h1>
<form id="form" action="https://www.freecodecamp.com/email-submit).">
<input type="email" id="email" placeholder="Email">
<input id="submit" type="submit" value="submit">
</form>
</footer>
</body>
@import url('https://fonts.googleapis.com/css2?family=Roboto:wght@300&display=swap');
@import url('https://fonts.googleapis.com/css2?family=Major+Mono+Display&family=Raleway&display=swap');
:root {
--xbox-green:hsl(117, 87%, 57%);
--xbox-gray: #201f24;
--xbox-black: rgb(0, 0, 0);
--heading:'Raleway', sans-serif;
--content:'Roboto', sans-serif;
}
* {
box-sizing: border-box;
}
body {
margin: 0;
padding: 0;
overflow-x: hidden;
background-color:var(--xbox-gray);
}
html{
font-size: 100%;
scroll-behavior: smooth;
}
section{
width: 100vw;
height: 100vh;
}
span {
color: var(--xbox-green);
}
.navbar {
display: flex;
position: fixed;
top: 0;
justify-content: space-between;
align-items: center;
width: 100vw;
background-color: #201f24;
color: white;
z-index: 10;
}
#header-img{
width: 58px;
padding:5px;
position: relative;
left: 1rem;
}
.navbar-links {
height: 100%;
}
.navbar-links ul {
display: flex;
margin: 0;
padding: 0;
}
.navbar-links li {
list-style: none;
}
.navbar-links li a{
display: block;
text-decoration: none;
font-size: 1.5rem;
font-family: 'Roboto', sans-serif;
color: white;
padding: 1rem 2rem 1rem 2rem;
}
li>a:hover{
color: var(--xbox-black);
}
.navbar-links li:hover{
background-color: var(--xbox-green);
transition: all 100ms ease;
}
.toggle-button {
position: absolute;
top: .75rem;
right: 1rem;
display: none;
flex-direction: column;
justify-content: space-between;
width: 30px;
height: 21px;
}
.toggle-button .bar {
height: 3px;
width: 100%;
background-color: white;
border-radius: 10px;
}
section:nth-of-type(1){
position: relative;
}
#image1{
width: 40%;
position: absolute;
padding-top:clamp(3rem,1rem,3.5rem);
left: 5vw;
z-index: 3;
}
#product-info {
width: 50%;
position: relative;
font-size: 62.5%;
top: 5rem;
right: 5rem;
padding-left: 6rem;
flex-direction: column;
justify-content: flex-end;
align-content: space-between;
float: right;
}
#product-info:after {
content: "";
display: block;
padding-bottom: 100%;
}
#title {
color: var(--xbox-green);
font-size: 8em;
position: absolute;
line-height: 1;
font-family: 'Raleway', sans-serif;
text-transform: uppercase;
}
#info {
color: whitesmoke;
position: absolute;
top: 16rem;
margin:0;
font-family: 'Roboto', sans-serif;
font-size: 5em;
}
#buy {
width: 200px;
height: 50px;
border: 4px solid var(--xbox-green);
color: var(--xbox-green);
background-color: transparent;
cursor: pointer;
font-size: 3em;
position: absolute;
top: 28rem;
font-family: 'Roboto', sans-serif;
}
#buy:hover{
color: var(--xbox-black);
background-color: var(--xbox-green);
transition: 0.5s;
}
section:nth-of-type(2){
position: relative;
}
#image2{
width: 40%;
padding-top: 2rem;
position: absolute;
right: 4rem;
bottom: 5rem;
}
#heading1{
font-size: 5rem;
color: white;
font-family:var(--heading);
position: absolute;
left: 5rem;
bottom: 17rem;
}
#title2{
font-size: 1.8rem;
font-family: var(--heading);
color: rgb(255, 255, 255);
position: absolute;
bottom: 15rem;
left: 5rem;
}
#info2{
text-align: start;
font-family: var(--content);
font-size: 1.5rem;
color: aliceblue;
width: 40%;
position: absolute;
bottom: 10rem;
left: 5rem;
}
.link1:link{
font-family: var(--heading);
text-decoration: none;
font-size: 2rem;
position: absolute;
bottom: 8rem;
left: 5rem;
cursor: pointer;
}
.link1:hover{
border-bottom: 2px solid var(--xbox-green);
}
section:nth-of-type(3){
margin-bottom: 8rem;
}
#container{
display: grid;
grid-template-columns: repeat(3,1fr);
grid-gap: 2rem;
width: 80vw;
position: relative;
left: 8rem;
top: 4rem;
}
.card>img{
width: 100%;
-webkit-transition: 0.4s ease;
transition: 0.4s ease;
}
.card>img:hover{
-webkit-transform: scale(1.08);
transform: scale(1.08);
}
.card>h2{
font-family: var(--heading);
font-size: 2rem;
}
.spec{
font-family: var(--content);
color: white;
font-size: 1.5rem;
}
section:nth-of-type(4){
position: relative;
margin-bottom: 8rem;
}
#container1 {
position: relative;
display: flex;
justify-content: center;
align-content: center;
}
#logo{
width:8%;
position: absolute;
left: 5rem;
top: 8rem;
}
#image4 {
width: 27%;
position: absolute;
top: 6rem;
}
#headline2 {
color: azure;
font-size: 4rem;
position: absolute;
margin-top: 15rem;
left:5rem ;
font-family: var(--heading);
}
#info4 {
font-size: 1.5rem;
font-family: var(--content);
color: azure;
text-align: left;
width: 25%;
position: absolute;
top: 26rem;
left:5rem;
}
#container2{
display: flex;
flex-direction: column;
justify-content: space-between;
position: absolute;
right: 3rem;
bottom: 2rem;
width: 30%;
height: 80%;
}
#info5,#info6{
font-family: var(--content);
font-size: 1.5rem;
color: white;
text-align: left;
}
iframe{
width: 100%;
height: 50%;
}
section:nth-of-type(5){
margin-bottom: 20rem;
}
#container3{
position: relative;
right: 3rem;
top: 5rem;
float: right;
width: 60vw;
height: 60vh;
display: grid;
grid-gap: 2rem;
grid-template-columns: 2fr 2fr 1.5fr;
grid-template-rows: 0.5fr 1fr 1fr;
}
#image5{
grid-column: 1/2;
grid-row:1/3;
width: 100%;
}
#image6{
width: 100%;
grid-column: 2/4;
grid-row: 1/2;
}
#image7{
width: 100%;
grid-column: 2/3;
grid-row: 2/3;
}
#image8{
width: 100%;
grid-column: 3/4;
}
#container4{
position: relative;
width: 40vw;
top: 8rem;
}
#headline3{
color: white;
font-size: 5rem;
position: absolute;
left: 5rem;
font-family: var(--heading);
}
#info7{
width: 50%;
font-size: 1.5rem;
font-family: var(--content);
color: azure;
text-align: left;
position: absolute;
top: 15rem;
left: 5rem;
}
.link2:link{
font-family: var(--heading);
text-decoration: none;
font-size: 2rem;
position: absolute;
top: 38rem;
left: 5rem;
cursor: pointer;
}
.link2:hover{
border-bottom: 2px solid var(--xbox-green);
}
footer{
height: 25vh;
width: 100vw;
background-color: rgb(20, 20, 20);
position: relative;
display: flex;
justify-content: center;
align-content: center;
}
footer>h1{
font-family: var(--heading);
font-size: 2rem;
color: white;
}
form{
width:50%;
height: 50%;
position: relative;
top: 2rem;
right:3rem;
display: flex;
justify-content: space-around;
}
input[type="email"]{
position: absolute;
width: 50%;
height: 50%;
font-family: var(--heading);
font-size: 1.5rem;
}
input[type="email"]::placeholder{
font-family: var(--heading);
opacity: 1;
font-size: 1.5rem;
}
input[type="submit"]{
position: absolute;
right: 0;
width: 20%;
height: 50%;
background-color: transparent;
color: var(--xbox-green);
font-family: var(--heading);
font-size: 1.5rem;
border: 2px solid var(--xbox-green);
}
@media (max-width: 800px) {
.navbar {
flex-direction: column;
align-items: flex-start;
}
.toggle-button {
display: flex;
}
.navbar-links {
display: none;
width: 100%;
}
.navbar-links ul {
width: 100%;
flex-direction: column;
}
.navbar-links ul li {
text-align: center;
}
.navbar-links ul li a {
padding: .5rem 1rem;
}
.navbar-links.active {
display: flex;
}
}
const toggleButton = document.getElementsByClassName('toggle-button')[0]
const navbarLinks = document.getElementsByClassName('navbar-links')[0]
toggleButton.addEventListener('click', () => {
navbarLinks.classList.toggle('active')
})
Also see: Tab Triggers