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="header" class="absolute top-0 inset-x-0 border-b border-white py-8">
<nav class="container mx-auto flex justify-between items-center">
<ul class="hidden md:flex gap-4 text-lg">
<li><a href="#">Destinations</a></li>
<li><a href="#">About</a></li>
</ul>
<a href="#" class="logo uppercase text-xl md:2xl">Wandawave</a>
<ul class="hidden md:flex items-center gap-4 text-lg">
<li>
<a href="#">
<svg role="img" width="30px" height="30px" viewBox="0 -0.5 25 25" fill="none" xmlns="http://www.w3.org/2000/svg">
<title>Find me on Instagram</title>
<path fill-rule="evenodd" clip-rule="evenodd" d="M15.5 5H9.5C7.29086 5 5.5 6.79086 5.5 9V15C5.5 17.2091 7.29086 19 9.5 19H15.5C17.7091 19 19.5 17.2091 19.5 15V9C19.5 6.79086 17.7091 5 15.5 5Z" stroke="#000000" stroke-width="1.5" stroke-linecap="round" stroke-linejoin="round" />
<path fill-rule="evenodd" clip-rule="evenodd" d="M12.5 15C10.8431 15 9.5 13.6569 9.5 12C9.5 10.3431 10.8431 9 12.5 9C14.1569 9 15.5 10.3431 15.5 12C15.5 12.7956 15.1839 13.5587 14.6213 14.1213C14.0587 14.6839 13.2956 15 12.5 15Z" stroke="#000000" stroke-width="1.5" stroke-linecap="round" stroke-linejoin="round" />
<rect x="15.5" y="9" width="2" height="2" rx="1" transform="rotate(-90 15.5 9)" fill="#000000" />
<rect x="16" y="8.5" width="1" height="1" rx="0.5" transform="rotate(-90 16 8.5)" stroke="#000000" stroke-linecap="round" />
</svg>
</a>
</li>
<li>
<a href="#">
<svg role="img" width="25px" height="25px" viewBox="0 0 24 24" fill="none" xmlns="http://www.w3.org/2000/svg">
<title>Contact me via email</title>
<path d="M21 8L17.4392 9.97822C15.454 11.0811 14.4614 11.6326 13.4102 11.8488C12.4798 12.0401 11.5202 12.0401 10.5898 11.8488C9.53864 11.6326 8.54603 11.0811 6.5608 9.97822L3 8M6.2 19H17.8C18.9201 19 19.4802 19 19.908 18.782C20.2843 18.5903 20.5903 18.2843 20.782 17.908C21 17.4802 21 16.9201 21 15.8V8.2C21 7.0799 21 6.51984 20.782 6.09202C20.5903 5.71569 20.2843 5.40973 19.908 5.21799C19.4802 5 18.9201 5 17.8 5H6.2C5.0799 5 4.51984 5 4.09202 5.21799C3.71569 5.40973 3.40973 5.71569 3.21799 6.09202C3 6.51984 3 7.07989 3 8.2V15.8C3 16.9201 3 17.4802 3.21799 17.908C3.40973 18.2843 3.71569 18.5903 4.09202 18.782C4.51984 19 5.07989 19 6.2 19Z" stroke="#000000" stroke-width="2" stroke-linecap="round" stroke-linejoin="round" />
</svg>
</a>
</li>
</ul>
<div id="menuBtn" role="menu" class="md:hidden px-7">
<button id="close-menu" class="hidden">
<i class="fa-solid fa-xmark text-3xl"></i>
</button>
<button id="menuIcon">
<i class="fa-solid fa-ellipsis-vertical text-3xl"></i>
</button>
</div>
<div id="menu" class="hidden absolute inset-0 top-24 bg-white flex flex-col items-center justify-between py-20">
<div class="flex flex-col gap-5 text-2xl">
<a href="#">Destinations</a>
<a href="#">About</a>
</div>
<ul class="flex gap-10">
<li>
<a href="#">
<i class="fa-brands fa-instagram text-2xl" style="color: #0077cc;"></i>
</a>
</li>
<li>
<a href="#">
<i class="fa-regular fa-envelope text-2xl" style="color: #0077cc;"></i>
</a>
</li>
</ul>
</div>
</nav>
</header>
<main>
<div class="landing-section py-32 pt-44">
<div class="container mx-auto">
<div class="md:flex justify-between items-start mb-12">
<p class="text-3xl md:text-4xl leading-relaxed lg:5xl lg:leading-relaxed md:w-7/12 md:font mb-14">
Documenting the very best in Food and Travel Life.
</p>
<a href="#" class="my-5 inline-block border border-white px-10 py-4">Explore</a>
</div>
<div class="flex gap-10 text-center">
<div class="w-6/12">
<img src="https://source.unsplash.com/CbfU9qh6KOY/400x300" class="lg:w-10/12 inline-block mx-auto lg:object-cover" alt="a brown building" />
<p class="mt-4 font-light">Aug 17, 2023</p>
<a href="#">Unusual AirBnB apartments I've seen</a>
</div>
<div class="w-6/12">
<img src="https://source.unsplash.com/kn_ANxnwCQ0/400x300" class="lg:w-10/12 lg:object-cover inline-block mx-auto" alt="a nigerian meal" />
<p class="mt-4 font-light">Jan 10, 2023</p>
<a href="#">My top 10 favorite Nigerian meal</a>
</div>
</div>
</div>
</div>
<section aria-label="Blog posts related to travel content" class="my-20 container mx-auto lg:flex gap-8 justify-between">
<div>
<p class="text-color text-3xl lg:text-4xl mb-16">Travel Content</p>
<p class="font-light mb-10">Explore. Experience. Enjoy.</p>
<a href="#" class="inline-block border border-color text-color px-10 py-4 mb-10">Read more</a>
</div>
<div>
<div class="flex justify-end gap-3 text-2xl py-8 cursor-pointer">
<button aria-label="Previous" disabled>
<i class="fa-solid fa-chevron-right fa-rotate-180" style="color: #9da3af;"></i>
</button>
<button aria-label="Next">
<i class="fa-solid fa-chevron-right" style="color: #323439;"></i>
</button>
</div>
<div class="flex flex-nowrap gap-3 overflow-visible">
<article>
<a href="#">
<img src="https://source.unsplash.com/2Mb2zb-vlbA/300x450" alt="bridge in novi sad" class="w-full" />
<p class="mt-4 font-light">Aug 17, 2023</p>
<h2>Explore Novi Sad</h2>
</a>
</article>
<article>
<a href="#">
<img src="https://source.unsplash.com/6iSZzFMKQbs/300x450" alt="a beach view in mauritius" class="w-full" />
<p class="mt-4 font-light">Sept 21, 2022</p>
<h2>Best time to visit Mauritius</h2>
</a>
</article>
<article>
<a href="#">
<img src="https://source.unsplash.com/9_uYzdZ3084/300x450" alt="three nigerian men playing saxophone" class="w-full" />
<p class="mt-4 font-light">Aug 17, 2023</p>
<h2>Nigerian parties should be studied</h2>
</a>
</article>
</div>
</div>
</section>
<section aria-label="Blog posts related to food content" class="my-20 container mx-auto lg:flex gap-8 justify-between">
<div>
<p class="text-color text-3xl lg:text-4xl mb-16">Food Content</p>
<p class="font-light mb-10">Savor the Moment, Taste the World.</p>
<a href="#" class="border border-color text-color px-10 py-4 mb-8">Read more</a>
</div>
<div>
<div class="flex justify-end gap-3 text-2xl py-8 cursor-pointer ">
<button aria-label="Previous" disabled>
<i class="fa-solid fa-chevron-right fa-rotate-180" style="color: #9da3af;"></i>
</button>
<button aria-label="Next">
<i class="fa-solid fa-chevron-right" style="color: #323439;"></i>
</button>
</div>
<div class="flex flex-nowrap gap-4 overflow-visible">
<article>
<a href="#">
<img src="https://source.unsplash.com/_VRo59IsqLo/300x450" alt="nigerian food" class="w-full lg:object-cover" />
<p class="mt-4 font-light">Aug 17, 2023</p>
<h2>Nigerian food: Fried rice</h2>
</a>
</article>
<article>
<a href="#">
<img src="https://source.unsplash.com/AAHdL8gp5b8/300x450" alt="chocolate dessert" class="w-full lg:object-cover" />
<p class="mt-4 font-light">Sept 21, 2022</p>
<h2>The best desserts I had in Serbia</h2>
</a>
</article>
<article>
<a href="#">
<img src="https://source.unsplash.com/FIGcCVQeGwE/300x450" alt="ghanian food" class="w-full lg:object-cover" />
<p class="mt-4 font-light">Aug 17, 2023</p>
<h2>All the local foods I had in Ghana</h2>
</a>
</article>
</div>
</div>
</section>
</main>
<footer class="footer-style">
<div class="container mx-auto">
<section aria-label="Newsletter form" class="py-12">
<p class="text-sm my-5">Subscribe to my newsletter</p>
<form class="flex">
<div>
<label for="email" class="text-xs pb-3 block">Email (required):
</label>
<input placeholder="example@gmail.com" id="email" autocomplete="email" class="bg-transparent border-2 border-white py-2 px-3 inline-block placeholder:font-sm" required />
</div>
<button type="submit" class="landing-section px-10 py-3 inline-block rounded-lg ml-6 text-lg self-end">Submit</button>
</form>
</section>
<div class="flex justify-center gap-1 text-center pb-3">
<svg role="img" width="20px" height="20px" viewBox="0 0 24 24" fill="none" xmlns="http://www.w3.org/2000/svg">
<title>Copyright</title>
<path d="M2 12C2 6.47715 6.47715 2 12 2C17.5228 2 22 6.47715 22 12C22 17.5228 17.5228 22 12 22C6.47715 22 2 17.5228 2 12Z" stroke="#1C274C" stroke-width="1.5" />
<path d="M14 15.6672C13.475 15.8812 12.8952 16 12.2857 16C9.91878 16 8 14.2091 8 12C8 9.79086 9.91878 8 12.2857 8C12.8952 8 13.475 8.11876 14 8.33283" stroke="#1C274C" stroke-width="1.5" stroke-linecap="round" />
<!-- this svg doesn't have a title -->
</svg>
<p>Wandawave 2023</p>
<div class="text-center pb-4">This page is for accessbibility testing</div>
</div>
</div>
</footer>
:root {
--main-color: #016d73;
--secondary-color: #94bbe9;
}
body {
font-family: "Montserrat", sans-serif;
overflow: visible;
}
.logo {
font-family: "Montserrat Alternates", sans-serif;
}
.landing-section {
background: var(--secondary-color);
}
.text-color {
color: var(--main-color);
}
.border-color {
border-color: var(--main-color);
}
.footer-style {
background: #edf0fc;
}
a, button {
display: inline-block;
}
a:hover {
border: 1px dashed rgb(99 102 241);
}
input:focus, a:focus, button:focus {
outline-width: 0px;
display: inline-block;
border: 2px solid rgb(99 102 241);
}
input::placeholder {
font-size: 12px;
}
const menuBtn = document.getElementById("menuBtn");
const menuIcon = document.getElementById("menuIcon");
const close = document.getElementById("close-menu");
const menu = document.getElementById("menu");
const header = document.getElementById("header");
menuBtn.addEventListener("click", () => {
if (menuIcon.classList.contains("hidden")) {
menuIcon.classList.remove("hidden");
close.classList.add("hidden");
menu.classList.add("hidden");
header.classList.add("absolute");
} else {
menuIcon.classList.add("hidden");
close.classList.remove("hidden");
menu.classList.remove("hidden");
header.classList.remove("absolute");
}
});
Also see: Tab Triggers