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.
<!--
This is a practice website of an online store modeled off of Urban Outfitter's website at the time to practice my HTML and CSS skills. The Javascript used here was guided my an online tutorial, so it does not reflect my knowledge of Javascript. However, the HTML and CSS is made from my own knowledge and therefore is reflective.
-->
<body>
<div id="promo">
<p class="left">everything you love, all in one place.</p>
<h3 class="center">MOST ♥ LIKED </h3>
<p class="right"><a href="#" class="promo-link">shop</a></p>
</div>
<nav>
<script src="https://kit.fontawesome.com/6823491d04.js"></script>
<div class="logo">
<h2>Giants & Dwarfs</h2>
</div>
<ul class="nav-links">
<li id="about"><a href="#">About</a></li>
<li id="womens"><a href="#">Women's</a></li>
<li id="mens"><a href="#">Men's</a></li>
<li id="sale"><a href="#">Sale</a></li>
<li id="cart"><a href="#"><i class="fas fa-shopping-cart"></i></a></li>
</ul>
<div class="burger">
<div class="line1"></div>
<div class="line2"></div>
<div class="line3"></div>
</div>
</nav>
<div class="body-content">
<div class="two-picture-division">
<a href="#"><img src="https://images.ctfassets.net/q602vtcuu3w3/7rnjSHqBEcgbtJ2pZqZarm/c32a5cbe533a8aab72aee54689ddb7e3/190617-WK3-WGW-4-Update.jpg"></a>
<a href="#"><img src="https://images.ctfassets.net/q602vtcuu3w3/6vo26Ry1p3rcvSURCYBoJH/2fdc52ccb0ee69352d8e02ff905d592a/190603-WK1-LGW-1.jpg"></a>
</div>
<div class="three-div">
<a href="#">
<img src="https://images.ctfassets.net/q602vtcuu3w3/7btvNrhUWJrd5UWYSRHtJr/43f9ce8f23d39c839f9b0e34991d97cc/190603-WK1-MGW-5.jpg">
</a>
<a href="#">
<img src="https://images.ctfassets.net/q602vtcuu3w3/5674zBs4G9hFqVyg2ceT6y/83fd495152f58a7bd12e64d68e541dcd/190617-WK3-HGW-7.jpg">
</a>
<a href="#">
<img src="https://images.ctfassets.net/q602vtcuu3w3/3Rz4KD78yXurQYIyqx6oyC/be018c5eeecd2df0a81471bb81177d8d/190617-WK3-WGW-7.jpg">
</a>
</div>
<div class="exclusives-title">
<h2>EXCLUSIVES</h2>
<hr/>
</div>
<div class="exclusive">
<a href="#">
<img src="https://s7d5.scene7.com/is/image/UrbanOutfitters/46953022_086_b?$medium$&qlt=80&fit=constrain">
<p class="picture-description">Champion Cropped Hoodie Sweatshirt</p>
</a>
<a href="#">
<img src="https://s7d5.scene7.com/is/image/UrbanOutfitters/50534346_034_b?$medium$&qlt=80&fit=constrain">
<p class="picture-description">FILA Disruptor 2 Sock Mesh Sneaker</p>
</a>
<a href="#">
<img src="https://s7d5.scene7.com/is/image/UrbanOutfitters/51077311_070_b?$medium$&qlt=80&fit=constrain">
<p class="picture-description">Mia Colona Coin Pendant Necklace</p>
</a>
<a href="#">
<img src="https://s7d5.scene7.com/is/image/UrbanOutfitters/51357671_001_b?$medium$&qlt=80&fit=constrain">
<p class="picture-description">Champion Sports Trim Bike Short</p>
</a>
<a href="#">
<img src="https://s7d5.scene7.com/is/image/UrbanOutfitters/51272904_074_b?$medium$&qlt=80&fit=constrain">
<p class="picture-description">Champion Hood Logo Hoodie Sweatshirt</p>
</a>
</div>
</div>
<footer>
<div class="email-section">
<div id="email-text">
<h2>Get Our Emails</h2>
<p>Sign up to receive Giants & Dwarfs emails and get first dibs on new arrivals, sales, exclusive content, events and more!</p>
</div>
<div id="email-input">
<p>Email Address:</p>
<input class="input-box-wide" type="email" name="emailaddress">
<input class="submit-button" type="submit">
</div>
</div>
<div class="footer-info">
<div id="help-info">
<h5>Help + Info</h5>
<hr>
<div class="footer-info-links">
<a href="#">
<p>Order Status</p>
</a>
<a href="#">
<p>Returns + Exchanges</p>
</a>
<a href="#">
<p>Shipping</p>
</a>
<a href="#">
<p>Orders + Payments</p>
</a>
<a href="#">
<p>FAQ</p>
</a>
<a href="#">
<p>See All Help Topics </p>
</a>
</div>
</div>
<div id="quick-links">
<h5>Quick Links</h5>
<hr>
<div class="footer-info-links">
<a href="#">
<p>In-Store Pickup</p>
</a>
<a href="#">
<p>Afterpay</p>
</a>
<a href="#">
<p>Brands</p>
</a>
<a href="#">
<p>Gift Cards</p>
</a>
<a href="#">
<p>Careers</p>
</a>
<a href="#">
<p>Shop Europe</p>
</a>
<a href="#">
<p>Shop Canada</p>
</a>
</div>
</div>
<div id="extras">
<h5>Extras</h5>
<hr>
<div class="footer-info-links">
<a href="#">
<p>Rewards</p>
</a>
<a href="#">
<p>MRKT</p>
</a>
<a href="#">
<p>Blog</p>
</a>
<a href="#">
<p>Community Cares</p>
</a>
<a href="#">
<p>Creative Services</p>
</a>
</div>
</div>
<div id="find-a-store">
<a>
<h5>Find A Store</h5>
<hr>
</a>
<div class="footer-info-links">
<a href="#">
<p>Store Locator</p>
</a>
<a href="#">
<p>UO Spaces</p>
</a>
<a href="#">
<p>Sign Up For Email</p>
</a>
</div>
</div>
<div id="follow-us">
<a>
<h5>Follow Us</h5>
<hr>
</a>
<div class="footer-info-links">
<a href="#">
<i class="fab fa-instagram"></i>
</a>
<a href="#">
<i class="fab fa-facebook"></i>
</a>
<a href="#">
<i class="fab fa-pinterest"></i>
</a>
</div>
</div>
</div>
</footer>
</body>
/*
Problems:
center the most liked banner
email text line up
smaller screen fit
phone size the br for footer doesn't fit
*/
* {
margin: 0px;
padding: 0px;
border-sizing: border-box;
}
#promo {
background-color: #f5c793;
display: grid;
grid-template-columns: 33.33% 33.33% 33.33%;
align-items: center;
min-height: 50px;
padding-top: 10px;
padding-bottom: 10px;
}
.left {
justify-self: stretch;
text-align: center;
}
.center {
justify-self: stretch;
text-align: center;
}
.right {
justify-self: stretch;
text-align: center;
}
.promo-link {
color: #222;
text-decoration-color: #222;
}
nav {
display: grid;
grid-template-columns: 50% 50%;
border-bottom: 0.3px solid #d3d3d3;
min-height: 40px;
align-items: center;
}
.nav-links {
display: flex;
list-style: none;
justify-self: end;
}
.nav-links li {
padding-left: 15px;
padding-right: 15px;
}
nav a {
text-decoration: none;
color: #767676;
}
nav a:hover {
color: #b2b2b2;
border-bottom: 1px solid black;
}
.logo {
color: #30336b;
text-transform: uppercase;
padding-left: 20px;
justify-self: start;
}
.burger {
display: none;
cursor: pointer;
padding-right: 5px;
justify-self: end;
}
.burger div {
width: 25px;
height: 3px;
background-color: rgb(226, 226, 226);
margin: 5px;
transition: all 0.3s ease;
}
/* PICTURE BODY SECTION */
.body-content {
display: grid;
overflow: hidden;
margin-left: 20px;
margin-right: 20px;
}
.two-picture-division {
display: grid;
grid-template-columns: 50% 50%;
grid-column-gap: 10px;
}
.three-div {
display: grid;
grid-template-columns: 1fr 1fr 1fr;
grid-column-gap: 10px;
}
.exclusives-title {
padding-top: 10px;
text-align: center;
display: grid;
}
.exclusives-title h2 {
font-weight: bold;
padding-bottom: 5px;
padding-top: 20px;
}
.exclusive {
display: grid;
grid-template-columns: 1fr 1fr 1fr 1fr 1fr;
grid-column-gap: 10px;
}
img {
display: inline;
opacity: 1;
padding-top: 10px;
width: 100%;
height: auto;
}
img:hover {
opacity: 0.8;
}
.picture-description {
text-align: left;
color: #222;
padding-top: 5px;
}
.exclusive a {
text-decoration: none;
}
footer {
background-color: #f4f4f4;
border-top: 0.3px solid #d3d3d3;
margin-top: 50px;
padding-left: 20vh;
padding-right: 20vh;
padding-top: 20px;
padding-bottom: 20px;
}
.email-section {
display: grid;
grid-template-columns: 50% 50%;
grid-column-gap: 10px;
margin-bottom: 60px;
margin-right: 30px;
margin-left: 30px;
}
#email-text h2 {
font-weight: 200;
padding-bottom: 5px;
}
#email-text p {
width: 60%;
}
#email-input {
padding-top: 8px;
}
#email-input p {
padding-bottom: 4px;
}
.submit-button {
background-color: #000;
border: none;
color: white;
padding: 15px 32px;
text-align: center;
text-decoration: none;
display: inline-block;
font-size: 16px;
}
.input-box-wide {
padding: 16px;
border: 0.3px solid black;
margin-right: 15px;
}
.footer-info {
display: grid;
grid-template-columns: 20% 20% 20% 20% 20%;
grid-column-gap: 10px;
margin-bottom: 60px;
margin-right: 30px;
margin-left: 30px;
}
.footer-info hr {
width: 50%;
margin-top: 10px;
margin-bottom: 5px;
}
.footer-info-links a {
text-decoration: none;
color: #000;
}
.footer-info-links p {
font-size: 14px;
}
@media screen and (max-width: 768px) {
body {
overflow-x: hidden;
}
.nav-links {
position: absolute;
right: 0px;
height: 100vh;
background-color: #fff;
display: flex;
flex-direction: column;
align-items: center;
width: 100%;
transform: translateX(100%);
transition: transform 0.5s ease-in;
font-size: 30px;
padding-top: 20vh;
}
.nav-links li {
opacity: 0;
margin-bottom: 10px;
}
.burger {
display: block;
}
#promo {
padding-left: 20px;
}
#email-text p {
width: 100%;
}
.submit-button {
margin-top: 10px;
}
.email-section {
display: block;
margin: 0;
padding-bottom: 20px;
}
.footer-info {
display: block;
margin: 0;
}
}
.nav-active {
transform: translateX(0%);
}
.scroll{
overflow-y: hidden;
}
.hidden{
display: none;
}
@keyframes navLinkFade {
from {
opacity: 0;
transform: translateX(50px);
}
to {
opacity: 1;
transform: translateX(0px);
}
}
.toggle .line1 {
transform: rotate(-45deg) translate(-5px, 6px);
}
.toggle .line2 {
opacity: 0;
}
.toggle .line3 {
transform: rotate(45deg) translate(-5px, -6px);
}
const navSlide = () =>{
const burger = document.querySelector(".burger");
const nav = document.querySelector('.nav-links');
const navLinks = document.querySelectorAll('.nav-links li');
const body = document.querySelector('body');
//toggle nav
burger.addEventListener('click', () =>{
nav.classList.toggle('nav-active');
body.classList.toggle('scroll');
navLinks.forEach((link, index) =>{
if(link.style.animation){
link.style.animation = '';
} else { //navLinkFade is the keyframe in css
link.style.animation = `navLinkFade 0.5s ease forwards ${index /7 + 1.1}s`
}
});
//burger animation
burger.classList.toggle('toggle');
});
}
navSlide();
Also see: Tab Triggers