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="top">
<nav class="flex justify-between my-4 mx-8 uppercase font-bold">
<h1 class="text-2xl">Melissa Smith</h1>
<a id="plus" class="cursor-pointer"><h1 class="text-2xl hidden md:block">Information</h1></a>
</a>
</nav>
<div id="dropdown" class="hidden w-screen mt-20 flex-col md:flex-row justify-start md:justify-around items-center md:items-start text-center">
<div class="flex flex-col md:w-1/3">
<h2 class="my-4 text-2xl uppercase font-bold">About</h2>
<p class="text-base mx-4 md:mx-0 pb-4">Lorem ipsum dolor sit amet consectetur adipisicing elit. Corporis ipsam ullam laudantium quia quibusdam, eligendi aliquam atque provident quasi rerum, omnis sint tempore perspiciatis cum!</p>
<p>1-800-555-1234</p>
<a href="#">[email protected]</a>
</div>
<div class="flex flex-col md:w-1/3 pt-4 md:pt-0">
<ul>
<h2 class="my-4 text-2xl uppercase font-bold">Equipment</h2>
<li>Nikon</li>
<li>Canon</li>
<li>GoPro</li>
<li>Olympus</li>
</ul>
</div>
<div class="flex flex-col pt-4 md:pt-0">
<h2 class="my-4 text-xl uppercase font-bold">Social</h2>
<div class="flex">
<a href="#"><i class="pr-4 text-3xl fab fa-instagram"></i></a>
<a href="#"><i class="text-3xl fab fa-facebook"></i></a>
</div>
</div>
</div>
</header>
<main class="grid grid-cols-1 md:grid-cols-2 lg:grid-cols-4 gap-2 my-12 mx-8">
<!-- Begin Project Grid -->
<section style="background-image: url(https://i.imgur.com/NOUGyc2.jpg)" class="col-span-1 md:col-span-2 row-span-1 md:row-span-3 gap-4 relative bg-cover bg-center">
<div class="absolute bottom-8 left-8 text-gray-100 uppercase">
<h1 class="text-2xl md:text-4xl font-bold">Northern Lights</h1>
<h3 class="text-base">October 2020</h3>
</div>
<div class="img-overlay absolute inset-0 h-full w-full opacity-0">
<a href="#" class="absolute inset-0 text-center text-5xl text-gray-100 transform translate-y-1/2">
<i class="fas fa-images"></i>
<h2 class="text-2xl">View Project</h2>
</a>
</div>
</section>
<section style="background-image: url(https://i.imgur.com/go84R4h.jpg)" class="row-span-1 md:row-span-2 gap-4 relative bg-cover bg-center" >
<div class="absolute bottom-8 left-8 text-gray-100 uppercase">
<h1 class="text-2xl md:text-4xl font-bold">Bakery</h1>
<h3 class="text-base">May 2020</h3>
</div>
<div class="img-overlay absolute inset-0 h-full w-full opacity-0">
<a href="#" class="absolute inset-0 text-center text-5xl text-gray-100 transform translate-y-1/2">
<i class="fas fa-images"></i>
<h2 class="text-2xl">View Project</h2>
</a>
</div>
</section>
<section style="background-image: url(https://i.imgur.com/pjDQJcs.jpg)" class="row-span-1 md:row-span-2 gap-4 relative bg-cover bg-center">
<div class="absolute bottom-8 left-8 text-gray-100 uppercase">
<h1 class="text-2xl md:text-4xl font-bold">Africa</h1>
<h2 class="text-base">June 2020</h2>
</div>
<div class="img-overlay absolute inset-0 h-full w-full opacity-0">
<a href="#" class="absolute inset-0 text-center text-5xl text-gray-100 transform translate-y-1/2">
<i class="fas fa-images"></i>
<h2 class="text-2xl">View Project</h2>
</a>
</div>
</section>
<section style="background-image: url(https://i.imgur.com/0CFiVId.jpg)" class="col-span-1 md:col-span-2 gap-4 relative bg-cover bg-center">
<div class="absolute bottom-8 left-8 text-gray-100 uppercase">
<h1 class="text-2xl md:text-4xl font-bold">Chicago</h1>
<h2 class="text-base font-semibold">May 2020</h2>
</div>
<div class="img-overlay absolute inset-0 h-full w-full opacity-0">
<a href="#" class="absolute inset-0 text-center text-5xl text-gray-100 transform translate-y-1/2">
<i class="fas fa-images"></i>
<h2 class="text-2xl">View Project</h2>
</a>
</div>
</section>
<section style="background-image: url(https://i.imgur.com/Ip7cQGo.jpg)" class="gap-4 relative bg-cover bg-top">
<div class="absolute bottom-8 left-8 text-gray-100 uppercase">
<h1 class="text-2xl md:text-4xl font-bold">Anchorage</h1>
<h2 class="text-base">August 2019</h2>
</div>
<div class="img-overlay absolute inset-0 h-full w-full opacity-0">
<a href="#" class="absolute inset-0 text-center text-5xl text-gray-100 transform translate-y-1/2">
<i class="fas fa-images"></i>
<h2 class="text-2xl">View Project</h2>
</a>
</div>
</section>
<section style="background-image: url(https://i.imgur.com/tf2npG4.jpg)" class="gap-4 relative bg-cover bg-center">
<div class="absolute bottom-8 left-8 text-gray-100 uppercase">
<h1 class="text-2xl md:text-4xl font-bold">Alaska</h1>
<h2 class="text-base">August 2019</h2>
</div>
<div class="img-overlay absolute inset-0 h-full w-full opacity-0">
<a href="#" class="absolute inset-0 text-center text-5xl text-gray-100 transform translate-y-1/2">
<i class="fas fa-images"></i>
<h2 class="text-2xl">View Project</h2>
</a>
</div>
</section>
<section style="background-image: url(https://i.imgur.com/3SmMHed.jpg)" class="gap-4 relative bg-cover bg-center">
<div class="absolute bottom-8 left-8 text-gray-100 uppercase">
<h1 class="text-2xl md:text-4xl font-bold">Pacific Ocean</h1>
<h2 class="text-base">March 2020</h2>
</div>
<div class="img-overlay absolute inset-0 h-full w-full opacity-0">
<a href="#" class="absolute inset-0 text-center text-5xl text-gray-100 transform translate-y-1/2">
<i class="fas fa-images"></i>
<h2 class="text-2xl">View Project</h2>
</a>
</div>
</section>
<section style="background-image: url(https://i.imgur.com/tnkVjaH.jpg)" class="gap-4 relative bg-cover bg-center">
<div class="absolute bottom-8 left-8 text-gray-100 uppercase">
<h1 class="text-2xl md:text-4xl font-bold">Florida</h1>
<h2 class="text-base font-semibold">December 2019</h2>
</div>
<div class="img-overlay absolute inset-0 h-full w-full opacity-0">
<a href="#" class="absolute inset-0 text-center text-5xl text-gray-100 transform translate-y-1/2">
<i class="fas fa-images"></i>
<h2 class="text-2xl">View Project</h2>
</a>
</div>
</section>
<section style="background-image: url(https://i.imgur.com/ivIXRAr.jpg)" class="gap-4 relative bg-cover bg-center">
<div class="absolute bottom-8 left-8 text-gray-100 uppercase">
<h1 class="text-2xl md:text-4xl font-bold">Vancouver</h1>
<h2 class="text-base">September 2020</h2>
</div>
<div class="img-overlay absolute inset-0 h-full w-full opacity-0">
<a href="#" class="absolute inset-0 text-center text-5xl text-gray-100 transform translate-y-1/2">
<i class="fas fa-images"></i>
<h2 class="text-2xl">View Project</h2>
</a>
</div>
</section>
<section style="background-image: url(https://i.imgur.com/hpnsdty.jpg)" class="gap-4 relative bg-cover bg-center">
<div class="absolute bottom-8 left-8 text-gray-100 uppercase">
<h1 class="text-2xl md:text-4xl font-bold">Japan</h1>
<h2 class="text-base">July 2020</h2>
</div>
<div class="img-overlay absolute inset-0 h-full w-full opacity-0">
<a href="#" class="absolute inset-0 text-center text-5xl text-gray-100 transform translate-y-1/2">
<i class="fas fa-images"></i>
<h2 class="text-2xl">View Project</h2>
</a>
</div>
</section>
<section style="background-image: url(https://i.imgur.com/snIN0FA.jpg)" class="col-span-1 row-span-1 md:col-span-2 md:row-span-2 gap-4 relative bg-cover bg-center">
<div class="absolute bottom-8 left-8 text-gray-100 uppercase">
<h1 class="text-2xl md:text-4xl font-bold">Denmark</h1>
<h2 class="text-base font-semibold">April 2020</h2>
</div>
<div class="img-overlay absolute inset-0 h-full w-full opacity-0">
<a href="#" class="absolute inset-0 text-center text-5xl text-gray-100 transform translate-y-1/2">
<i class="fas fa-images"></i>
<h2 class="text-2xl">View Project</h2>
</a>
</div>
</section>
<section style="background-image: url(https://i.imgur.com/lKnOCsT.jpg)" class="col-span-1 md:col-span-2 gap-4 relative bg-cover bg-center">
<div class="absolute bottom-8 left-8 text-gray-100 uppercase">
<h1 class="text-2xl md:text-4xl font-bold">Hawaii</h1>
<h2 class="text-base">January 2020</h2>
</div>
<div class="img-overlay absolute inset-0 h-full w-full opacity-0">
<a href="#" class="absolute inset-0 text-center text-5xl text-gray-100 transform translate-y-1/2">
<i class="fas fa-images"></i>
<h2 class="text-2xl">View Project</h2>
</a>
</div>
</section>
<section style="background-image: url(https://i.imgur.com/X6eHpci.jpg)" class="col-span-1 md:col-span-2 row-span-1 md:row-span-2 gap-4 relative bg-cover bg-center">
<div class="absolute bottom-8 left-8 text-gray-100 uppercase">
<h1 class="text-2xl md:text-4xl font-bold">Arizona</h1>
<h2 class="text-base">November 2019</h2>
</div>
<div class="img-overlay absolute inset-0 h-full w-full opacity-0">
<a href="#" class="absolute inset-0 text-center text-5xl text-gray-100 transform translate-y-1/2">
<i class="fas fa-images"></i>
<h2 class="text-2xl">View Project</h2>
</a>
</div>
</section>
<section style="background-image: url(https://i.imgur.com/pKxwCpK.jpg)" class="gap-4 relative bg-cover bg-center">
<div class="absolute bottom-8 left-8 text-gray-100 uppercase">
<h1 class="text-2xl md:text-4xl font-bold">Nevada</h1>
<h2 class="text-base">October 2019</h2>
</div>
<div class="img-overlay absolute inset-0 h-full w-full opacity-0">
<a href="#" class="absolute inset-0 text-center text-5xl text-gray-100 transform translate-y-1/2">
<i class="fas fa-images"></i>
<h2 class="text-2xl">View Project</h2>
</a>
</div>
</section>
<section style="background-image: url(https://i.imgur.com/UfVTNMg.jpg)" class="gap-4 relative bg-cover bg-center">
<div class="absolute bottom-8 left-8 text-gray-100 uppercase">
<h1 class="text-2xl md:text-4xl font-bold">Russia</h1>
<h2 class="text-base">August 2020</h2>
</div>
<div class="img-overlay absolute inset-0 h-full w-full opacity-0">
<a href="#" class="absolute inset-0 text-center text-5xl text-gray-100 transform translate-y-1/2">
<i class="fas fa-images"></i>
<h2 class="text-2xl">View Project</h2>
</a>
</div>
</section>
<section style="background-image: url(https://i.imgur.com/4ENNSFV.jpg)" class="gap-4 relative bg-cover bg-center">
<div class="absolute bottom-8 left-8 text-gray-100 uppercase">
<h1 class="text-2xl md:text-4xl font-bold ">London</h1>
<h2 class="text-base">April 2020</h2>
</div>
<div class="img-overlay absolute inset-0 h-full w-full opacity-0">
<a href="#" class="absolute inset-0 text-center text-5xl text-gray-100 transform translate-y-1/2">
<i class="fas fa-images"></i>
<h2 class="text-2xl">View Project</h2>
</a>
</div>
</section>
<section style="background-image: url(https://i.imgur.com/MpiFRSm.jpg)" class="gap-4 relative bg-cover bg-center">
<div class="absolute bottom-8 left-8 text-gray-100 uppercase">
<h1 class="text-2xl md:text-4xl font-bold">Tennessee</h1>
<h2 class="text-base">March 2020</h2>
</div>
<div class="img-overlay absolute inset-0 h-full w-full opacity-0">
<a href="#" class="absolute inset-0 text-center text-5xl text-gray-100 transform translate-y-1/2">
<i class="fas fa-images"></i>
<h2 class="text-2xl">View Project</h2>
</a>
</div>
</section>
<!-- End Project Grid -->
</main>
<footer class="flex flex-cols justify-center text-center my-8">
<a href="#top"><i class="text-2xl fas fa-chevron-up"></i>
<p class="text-xl">Back To Top</p></a>
</footer>
@import url('https://fonts.googleapis.com/css2?family=Bebas+Neue&family=PT+Sans:wght@400;700&display=swap');
html {
scroll-behavior: smooth;
}
body {
font-family: 'PT Sans', sans-serif;
background-color: #121212;
color: #ededed;
}
main {
grid-auto-rows: minmax(300px, auto);
grid-auto-flow: dense;
}
section {
cursor: pointer;
border-radius: 2px;
}
.img-overlay {
transition: .3s ease-in;
background-color: rgba(0,0,0,0.65);
}
section:hover .img-overlay {
opacity: 1;
}
h1, h2 {
font-family: 'Bebas Neue', cursive;
letter-spacing: 2px;
}
.show {
display: flex;
height: 50vh;
}
@media screen and (max-width: 480px) {
.show {
height: 100%;
}
}
#plus {
position: relative;
}
nav a:before {
position: absolute;
top: 4px;
right: 110%;
font-family: 'Font Awesome\ 5 Free';
content: "\f067"; /* FontAwesome Unicode */
}
let plus = document.getElementById('plus');
let dropdown = document.getElementById('dropdown');
plus.addEventListener('click', function(){
dropdown.classList.toggle('show');
});
Also see: Tab Triggers