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.
<html lang="en-US">
<head>
<meta charset="UTF-8">
<meta name="viewport" content="width=device-width, initial-scale=1">
<link rel="profile" href="https://gmpg.org/xfn/11">
<link href="https://fonts.googleapis.com/css?family=Fredoka+One|Lato" rel="stylesheet">
<title>Anthony CaLZaDilla A.K.A CLZD</title>
</head>
<body class="home blog hfeed" cz-shortcut-listen="true">
<nav id="site-navigation" class="main-navigation">
<ul>
<li>
<a href="#" class="nav_icon"><svg role="img" viewBox="0 0 24 24" xmlns="http://www.w3.org/2000/svg">
<title>LinkedIn icon</title>
<path
d="M20.447 20.452h-3.554v-5.569c0-1.328-.027-3.037-1.852-3.037-1.853 0-2.136 1.445-2.136 2.939v5.667H9.351V9h3.414v1.561h.046c.477-.9 1.637-1.85 3.37-1.85 3.601 0 4.267 2.37 4.267 5.455v6.286zM5.337 7.433c-1.144 0-2.063-.926-2.063-2.065 0-1.138.92-2.063 2.063-2.063 1.14 0 2.064.925 2.064 2.063 0 1.139-.925 2.065-2.064 2.065zm1.782 13.019H3.555V9h3.564v11.452zM22.225 0H1.771C.792 0 0 .774 0 1.729v20.542C0 23.227.792 24 1.771 24h20.451C23.2 24 24 23.227 24 22.271V1.729C24 .774 23.2 0 22.222 0h.003z" />
</svg></a>
<a class="nav_icon" href="https://twitter.com/clzd"><svg role="img" viewBox="0 0 24 24"
xmlns="http://www.w3.org/2000/svg">
<title>Twitter icon</title>
<path
d="M23.954 4.569c-.885.389-1.83.654-2.825.775 1.014-.611 1.794-1.574 2.163-2.723-.951.555-2.005.959-3.127 1.184-.896-.959-2.173-1.559-3.591-1.559-2.717 0-4.92 2.203-4.92 4.917 0 .39.045.765.127 1.124C7.691 8.094 4.066 6.13 1.64 3.161c-.427.722-.666 1.561-.666 2.475 0 1.71.87 3.213 2.188 4.096-.807-.026-1.566-.248-2.228-.616v.061c0 2.385 1.693 4.374 3.946 4.827-.413.111-.849.171-1.296.171-.314 0-.615-.03-.916-.086.631 1.953 2.445 3.377 4.604 3.417-1.68 1.319-3.809 2.105-6.102 2.105-.39 0-.779-.023-1.17-.067 2.189 1.394 4.768 2.209 7.557 2.209 9.054 0 13.999-7.496 13.999-13.986 0-.209 0-.42-.015-.63.961-.689 1.8-1.56 2.46-2.548l-.047-.02z" />
</svg></a>
<a href="#" class="nav_icon"><svg role="img" viewBox="0 0 24 24" xmlns="http://www.w3.org/2000/svg">
<title>Instagram icon</title>
<path
d="M12 0C8.74 0 8.333.015 7.053.072 5.775.132 4.905.333 4.14.63c-.789.306-1.459.717-2.126 1.384S.935 3.35.63 4.14C.333 4.905.131 5.775.072 7.053.012 8.333 0 8.74 0 12s.015 3.667.072 4.947c.06 1.277.261 2.148.558 2.913.306.788.717 1.459 1.384 2.126.667.666 1.336 1.079 2.126 1.384.766.296 1.636.499 2.913.558C8.333 23.988 8.74 24 12 24s3.667-.015 4.947-.072c1.277-.06 2.148-.262 2.913-.558.788-.306 1.459-.718 2.126-1.384.666-.667 1.079-1.335 1.384-2.126.296-.765.499-1.636.558-2.913.06-1.28.072-1.687.072-4.947s-.015-3.667-.072-4.947c-.06-1.277-.262-2.149-.558-2.913-.306-.789-.718-1.459-1.384-2.126C21.319 1.347 20.651.935 19.86.63c-.765-.297-1.636-.499-2.913-.558C15.667.012 15.26 0 12 0zm0 2.16c3.203 0 3.585.016 4.85.071 1.17.055 1.805.249 2.227.415.562.217.96.477 1.382.896.419.42.679.819.896 1.381.164.422.36 1.057.413 2.227.057 1.266.07 1.646.07 4.85s-.015 3.585-.074 4.85c-.061 1.17-.256 1.805-.421 2.227-.224.562-.479.96-.899 1.382-.419.419-.824.679-1.38.896-.42.164-1.065.36-2.235.413-1.274.057-1.649.07-4.859.07-3.211 0-3.586-.015-4.859-.074-1.171-.061-1.816-.256-2.236-.421-.569-.224-.96-.479-1.379-.899-.421-.419-.69-.824-.9-1.38-.165-.42-.359-1.065-.42-2.235-.045-1.26-.061-1.649-.061-4.844 0-3.196.016-3.586.061-4.861.061-1.17.255-1.814.42-2.234.21-.57.479-.96.9-1.381.419-.419.81-.689 1.379-.898.42-.166 1.051-.361 2.221-.421 1.275-.045 1.65-.06 4.859-.06l.045.03zm0 3.678c-3.405 0-6.162 2.76-6.162 6.162 0 3.405 2.76 6.162 6.162 6.162 3.405 0 6.162-2.76 6.162-6.162 0-3.405-2.76-6.162-6.162-6.162zM12 16c-2.21 0-4-1.79-4-4s1.79-4 4-4 4 1.79 4 4-1.79 4-4 4zm7.846-10.405c0 .795-.646 1.44-1.44 1.44-.795 0-1.44-.646-1.44-1.44 0-.794.646-1.439 1.44-1.439.793-.001 1.44.645 1.44 1.439z" />
</svg></a>
<a href="#" class="nav_icon"><svg role="img" viewBox="0 0 24 24" xmlns="http://www.w3.org/2000/svg">
<title>Dribbble icon</title>
<path
d="M12 24C5.385 24 0 18.615 0 12S5.385 0 12 0s12 5.385 12 12-5.385 12-12 12zm10.12-10.358c-.35-.11-3.17-.953-6.384-.438 1.34 3.684 1.887 6.684 1.992 7.308 2.3-1.555 3.936-4.02 4.395-6.87zm-6.115 7.808c-.153-.9-.75-4.032-2.19-7.77l-.066.02c-5.79 2.015-7.86 6.025-8.04 6.4 1.73 1.358 3.92 2.166 6.29 2.166 1.42 0 2.77-.29 4-.814zm-11.62-2.58c.232-.4 3.045-5.055 8.332-6.765.135-.045.27-.084.405-.12-.26-.585-.54-1.167-.832-1.74C7.17 11.775 2.206 11.71 1.756 11.7l-.004.312c0 2.633.998 5.037 2.634 6.855zm-2.42-8.955c.46.008 4.683.026 9.477-1.248-1.698-3.018-3.53-5.558-3.8-5.928-2.868 1.35-5.01 3.99-5.676 7.17zM9.6 2.052c.282.38 2.145 2.914 3.822 6 3.645-1.365 5.19-3.44 5.373-3.702-1.81-1.61-4.19-2.586-6.795-2.586-.825 0-1.63.1-2.4.285zm10.335 3.483c-.218.29-1.935 2.493-5.724 4.04.24.49.47.985.68 1.486.08.18.15.36.22.53 3.41-.43 6.8.26 7.14.33-.02-2.42-.88-4.64-2.31-6.38z" />
</svg></a>
</li>
</ul>
</nav>
<button class="clzd_logo toggle_btn" disable="false">
TOGGLE
</button>
<div id="page" class="site">
<div id="child" class="site-content">
<img alt="" src="https://pbs.twimg.com/profile_banners/50035439/1557894472/1500x500" style="width: 100%; max-width: 100%;display: block;">
<p>Lorem, ipsum dolor sit amet consectetur adipisicing elit. Eum ipsa provident hic similique labore ipsam totam minima, corporis laudantium reprehenderit numquam expedita unde quo rem beatae exercitationem officia at voluptatibus.</p>
<p>Lorem, ipsum dolor sit amet consectetur adipisicing elit. Eum ipsa provident hic similique labore ipsam totam minima, corporis laudantium reprehenderit numquam expedita unde quo rem beatae exercitationem officia at voluptatibus.
</p>
<p>Lorem, ipsum dolor sit amet consectetur adipisicing elit. Eum ipsa provident hic similique labore ipsam totam minima, corporis laudantium reprehenderit numquam expedita unde quo rem beatae exercitationem officia at voluptatibus.
</p>
<p>Lorem, ipsum dolor sit amet consectetur adipisicing elit. Eum ipsa provident hic similique labore ipsam totam minima, corporis laudantium reprehenderit numquam expedita unde quo rem beatae exercitationem officia at voluptatibus.
</p>
<p>Lorem, ipsum dolor sit amet consectetur adipisicing elit. Eum ipsa provident hic similique labore ipsam totam minima, corporis laudantium reprehenderit numquam expedita unde quo rem beatae exercitationem officia at voluptatibus.
</p>
<p>Lorem, ipsum dolor sit amet consectetur adipisicing elit. Eum ipsa provident hic similique labore ipsam totam minima, corporis laudantium reprehenderit numquam expedita unde quo rem beatae exercitationem officia at voluptatibus.
</p>
<p>Lorem, ipsum dolor sit amet consectetur adipisicing elit. Eum ipsa provident hic similique labore ipsam totam minima, corporis laudantium reprehenderit numquam expedita unde quo rem beatae exercitationem officia at voluptatibus.
</p>
<p>Lorem, ipsum dolor sit amet consectetur adipisicing elit. Eum ipsa provident hic similique labore ipsam totam minima, corporis laudantium reprehenderit numquam expedita unde quo rem beatae exercitationem officia at voluptatibus.
</p>
<p>Lorem, ipsum dolor sit amet consectetur adipisicing elit. Eum ipsa provident hic similique labore ipsam totam minima, corporis laudantium reprehenderit numquam expedita unde quo rem beatae exercitationem officia at voluptatibus.
</p>
</div>
<!-- #child -->
</div>
<!-- #page -->
<script type="text/javascript" src="https://clzd.me/wp-includes/js/wp-embed.min.js?ver=4.9.9"></script>
</body>
</html>
#page, #child { backface-visibility: hidden }
#page {
background-color: #efefef;
font-size: 16px;
}
#page::before {
box-shadow: inset 0px 0px 0px 10px #c1bebe;
}
button {
background-color: rgba(0,0,0,0.5)!important;
padding: 15px!important;
border: 1px solid!important;
color: #fff!important;
display: inline-block!important;
width: auto!important;
}
jQuery(document).ready(function($) {
let s,
MenuToggle = {
settings: {
elBtn: $(".toggle_btn"),
elBody: $("body"),
elParent: $("#page"),
elChild: $("#child"),
elLi: $(".main-navigation li"),
elNavIcon: $(".nav_icon"),
pageTop: 27,
pageRotation: -13,
eBool: true,
last_known_scroll_position: 0,
ticking: false,
eStrength: null,
ePoints: null,
saveScroll: null,
saveWidth: null
},
init: function() {
s = MenuToggle.settings;
this.bindWindowEvents();
this.bindUIActions();
MenuToggle.scroll();
},
scroll: () => {
// Scroll event listener to save current scroll position
window.addEventListener('scroll', function(e) {
s.last_known_scroll_position = window.scrollY;
});
},
unScroll: () => {
// Reinstate users last scroll position before menu open
window.scrollTo(0, s.saveScroll);
},
resize: () => {
// Listen to Window resize events
if (matchMedia) {
// Set Window min width to 640px
const mq = window.matchMedia("(min-width: 640px)");
// Call widthChange() if window on window resize
mq.addListener(MenuToggle.widthChange);
MenuToggle.widthChange(mq);
}
},
widthChange: mq => {
if (mq.matches) {
// window width is 640px or more
s.pageTop = 30;
s.pageRotation = -8;
} else {
// window width is less than 640px
s.pageTop = 60;
s.pageRotation = -3;
}
},
bodyClass: (el) => {
$('body').addClass(el);
},
menuIn: () => {
s.eBool = false;
// Save the current scroll position to saveScroll
s.saveScroll = s.last_known_scroll_position;
// Create New GSAP Timeline
var tl = new TimelineMax();
tl.set(".nav_icon", { trasformOrigin: "50% 50%" }, "start")
.set(".nav_icon path", { fill: "#666" }, "start")
// Remove pointer events while page open animation is running
.set([s.elBtn], { pointerEvents: "none", transformOrigin: "50% 50%" }, "start")
.addLabel("go", "+=0.25")
// Add 'go' class to <body/>
.call(MenuToggle.bodyClass, ["go"], this, "go")
// Set <body/> to overflow hidden
.set(s.elBody, { overflow: "hidden" }, "go")
// Move <#child>'s vertical position upwards using negative value of s.last_known_scroll_position
.set(s.elChild, { y: -s.last_known_scroll_position }, "go")
// Switch <#page> to position fixed and width/height 100% so it matches any Window
.set(s.elParent, { position: "fixed", overflow: "hidden", width: "100%", height: "100%" }, "go")
// Rotate <#page> from the bottom-right corner of Window over 0.75 seconds
.to(s.elParent, 0.75, { transformOrigin: "100% 100%", rotation: s.pageRotation, y: s.pageTop, ease: Back.easeOut.config(1.75) }, "open")
// Scale toggle button 1.5x bigger over 0.25 seconds
.to(s.elBtn, 0.25, { scale: 1.5, ease: Power2.easeIn }, "open")
// Stagger in the social nav icons
.staggerFrom(".nav_icon", 0.75, { y: "+=15px", scale: 0, autoAlpha: 0, rotation: -3, ease: Elastic.easeOut.config(1, 0.5) }, 0.15, "open")
// Return pointer events to toggle button
.set(s.elBtn, { pointerEvents: "all" });
return tl;
},
menuOut: () => {
s.eBool = true;
// Create New GSAP Timeline
let tl = new TimelineMax();
// Remove pointer events while page open animation is running
tl.set(s.elBtn, { pointerEvents: "none" }, "abc")
// Scale toggle button back to 1 over 0.1 seconds
.to(s.elBtn, 0.1, { scale: 1, ease: Power2.easeIn }, "rotateOut")
// Rotate <#page> back into original position over 0.45 seconds
.to(s.elParent, 0.45, { rotation: 0, y: 0, ease: Back.easeIn.config(2) }, "rotateOut")
// Fade and Scale social icons to 0 over 0.25 seconds
.to(".nav_icon", 0.25, { scale: 0, autoAlpha: 0 }, "rotateOut")
.to("html", 0.25, { backgroundColor: "#191718" }, "rotateOut+=0.28")
// Switch <#page> to position relative and overflow to visible for scrolling
.set(s.elParent, { position: "relative", overflow: "visible", width: "100%", height: "100%" }, "out")
// Clear inline style CSS of negative s.last_known_scroll_position added by GSAP
.set(s.elChild, { clearProps: "all" }, "out")
// Set <body> overflow to visible for scrolling
.set(s.elBody, { overflow: "visible" }, "out")
// Call unScroll() to reinstate users last scroll position before menu open
.call(MenuToggle.unScroll)
// Return pointer events to toggle button
.set(s.elBtn, { pointerEvents: "all" })
.set(".nav_icon", { clearProps: "all" });
$('body').removeClass('go');
return tl;
},
menu: () => {
// If true call function to rotate page
if (s.eBool === true) {
MenuToggle.menuIn();
} else {
// Otherwise call function to rotate page back to original position
MenuToggle.menuOut();
}
},
bindWindowEvents: () => {
// On scroll or window resize call these functions
MenuToggle.scroll();
MenuToggle.resize();
},
bindUIActions: () => {
// Call open/close functions when toggle button clicked
s.elBtn.on("click", () => {
MenuToggle.menu();
});
}
}; // End s, etc.
'use strict';
MorphSVGPlugin.convertToPath("circle, rect, ellipse, line, polygon, polyline");
MenuToggle.init();
});
Also see: Tab Triggers