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.
<div id="topBar">top nav</div>
<header class="header" id="mainHeader" role="banner">
<a class="brand" href="">
<svg viewBox="0 0 520 216" xmlns="http://www.w3.org/2000/svg">
<g id="Page-1" stroke="none" stroke-width="1" fill="none" fill-rule="evenodd">
<g id="Group" fill-rule="nonzero">
<path d="M125.964 176.293v-7.547H107.15v-30.189h-8.302v37.736h27.116Zm11.482-32.075v-7.278h-8.625v7.278h8.625Zm-.215 32.075v-28.895h-8.194v28.895h8.194Zm13.207 0v-16.118c0-3.882 1.887-5.877 4.96-5.877s4.798 1.995 4.798 5.877v16.118h8.194v-16.118c0-3.882 1.887-5.877 4.96-5.877 3.072 0 4.797 1.995 4.797 5.877v16.118h8.194V157.48c0-6.954-3.666-10.62-9.757-10.62-3.935 0-6.954 1.617-9.488 4.582-1.51-2.91-4.367-4.582-8.14-4.582-4.151 0-6.63 2.21-8.518 4.636v-4.097h-8.194v28.895h8.194Zm54.016.647c5.23 0 9.111-2.049 11.806-5.39l-4.69-4.152c-2.264 2.103-4.258 2.965-7.008 2.965-3.665 0-6.253-1.94-7.062-5.66h20.108c.054-.755.108-1.51.108-2.157 0-8.194-4.42-15.687-14.07-15.687-8.41 0-14.286 6.793-14.286 15.04v.108c0 8.841 6.415 14.933 15.094 14.933Zm5.283-17.358h-12.345c.647-3.72 2.858-6.146 6.254-6.146 3.45 0 5.606 2.48 6.091 6.146Zm19.57 16.711V165.62c0-6.9 3.342-10.188 8.786-10.188h.432v-8.572c-4.852-.215-7.548 2.372-9.219 6.361v-5.822h-8.194v28.895h8.194Zm20.43-32.075v-7.278h-8.625v7.278h8.625Zm-.215 32.075v-28.895h-8.194v28.895h8.194Zm18.652.647c5.768 0 9.003-2.21 11.806-5.283l-4.798-4.852c-1.994 1.887-3.881 3.073-6.63 3.073-4.475 0-7.332-3.558-7.332-7.978v-.108c0-4.259 2.911-7.87 7.008-7.87 2.911 0 4.744 1.239 6.577 3.18l5.013-5.391c-2.695-3.019-6.091-4.852-11.536-4.852-8.841 0-15.148 6.793-15.148 15.04v.108c0 8.248 6.36 14.933 15.04 14.933Zm22.642-.647v-8.787l2.857-3.019 7.547 11.806h9.38l-11.375-17.52 10.998-11.375h-9.812l-9.595 10.512v-20.97h-8.194v39.353h8.194Z" id="Limerick" fill="#000" />
<path d="M104.159 215.52v-15.593l11.878 15.593h4.59V190.99h-5.325v15.103l-11.494-15.103h-4.975v24.529h5.326Zm26.28.35c2.698 0 4.275-1.437 5.501-3.014v2.664h5.327v-18.782h-5.327v10.477c0 2.523-1.296 3.82-3.328 3.82-2.033 0-3.224-1.297-3.224-3.82v-10.477h-5.326v12.159c0 4.31 2.347 6.973 6.377 6.973Zm20.183-.035c1.787 0 3.084-.42 4.205-1.086v-4.275c-.77.42-1.647.665-2.628.665-1.191 0-1.717-.595-1.717-1.822v-8.024h4.415v-4.555h-4.415v-4.8h-5.326v4.8h-2.243v4.555h2.243v8.9c0 4.345 2.208 5.642 5.466 5.642Zm13.035.035c4.065 0 7.184-1.892 7.184-6.062v-.07c0-3.434-3.049-4.696-5.677-5.572-2.032-.7-3.82-1.191-3.82-2.242v-.07c0-.736.666-1.297 1.963-1.297 1.367 0 3.224.666 5.08 1.752l2.033-3.679c-2.032-1.367-4.625-2.172-7.008-2.172-3.784 0-6.868 2.137-6.868 5.956v.07c0 3.645 2.979 4.871 5.607 5.642 2.067.63 3.89 1.016 3.89 2.172v.07c0 .842-.702 1.402-2.243 1.402-1.752 0-3.89-.77-5.922-2.242l-2.278 3.504c2.488 1.962 5.431 2.838 8.06 2.838Zm14.577-.35v-10.478c0-2.522 1.297-3.819 3.329-3.819s3.224 1.297 3.224 3.82v10.477h5.326v-12.16c0-4.31-2.348-6.973-6.377-6.973-2.699 0-4.275 1.437-5.502 3.014v-9.461h-5.326v25.58h5.326Zm23.652.42c3.4 0 5.922-1.332 7.674-3.504l-3.048-2.698c-1.472 1.366-2.768 1.927-4.555 1.927-2.383 0-4.065-1.261-4.59-3.68h13.07c.034-.49.07-.98.07-1.4 0-5.327-2.874-10.198-9.146-10.198-5.466 0-9.286 4.416-9.286 9.777v.07c0 5.746 4.17 9.706 9.811 9.706Zm3.434-11.283h-8.024c.42-2.418 1.857-3.995 4.065-3.995 2.242 0 3.644 1.612 3.96 3.995Zm12.965 10.863v-25.58h-5.326v25.58h5.326Zm8.83 0v-25.58h-5.326v25.58h5.327Z" id="Nutshell" fill="#FA6400" />
<g id="bee" fill="#000">
<path d="M136.339 83.343c-2.074-9.508-8.757-17.21-17.878-20.6L88.175 51.48a22.925 22.925 0 0 0 3.392-12.025c0-8.259-4.365-15.513-10.907-19.589a19.01 19.01 0 0 1 5.525-11.74l1.275-1.275a4.014 4.014 0 1 0-5.676-5.676L80.509 2.45c-3.974 3.973-6.564 8.96-7.533 14.378a23.086 23.086 0 0 0-9.046.017c-1.243-6.273-4.662-11.919-9.798-15.98a4.014 4.014 0 0 0-4.98 6.296c4.018 3.177 6.545 7.73 7.137 12.737-6.513 4.082-10.856 11.32-10.856 19.557 0 4.403 1.242 8.522 3.391 12.025L18.54 62.742C9.418 66.134 2.735 73.835.661 83.342c-2.073 9.509.797 19.293 7.678 26.174 5.409 5.41 12.61 8.34 20.062 8.34 2.03 0 4.078-.218 6.112-.662 7.76-1.692 14.314-6.455 18.307-13.106 4.299 9.381 9.486 16.192 11.666 18.853v10.045a4.014 4.014 0 0 0 8.028 0v-10.045c2.18-2.66 7.367-9.472 11.667-18.853 3.992 6.651 10.547 11.414 18.306 13.106 2.035.444 4.082.661 6.112.661 7.451 0 14.654-2.93 20.062-8.339 6.881-6.88 9.751-16.665 7.678-26.173Zm-88.75 13.176a20.332 20.332 0 0 1-14.786 12.832 20.333 20.333 0 0 1-18.788-5.51c-4.939-4.94-7-11.964-5.511-18.788a20.332 20.332 0 0 1 12.833-14.787l26.848-9.983c-1.236 4.83-2.008 10.01-2.008 15.416 0 6.236 1.027 12.169 2.606 17.609l-1.193 3.21Zm20.906 18.456c-2.627-3.61-6.49-9.566-9.538-16.953h19.069c-3.05 7.378-6.909 13.34-9.531 16.953Zm12.288-24.98H56.207c-.892-3.271-1.543-6.717-1.832-10.282h28.248c-.29 3.562-.944 7.008-1.84 10.281ZM54.376 71.685c.353-4.321 1.242-8.473 2.446-12.35A22.919 22.919 0 0 0 68.5 62.521c4.264 0 8.258-1.167 11.688-3.192 1.2 3.876 2.086 8.028 2.436 12.356H54.376ZM68.5 54.495c-8.293 0-15.04-6.747-15.04-15.04 0-8.292 6.747-15.039 15.04-15.039 8.292 0 15.04 6.747 15.04 15.04 0 8.292-6.748 15.039-15.04 15.039Zm54.484 49.345a20.334 20.334 0 0 1-18.787 5.512A20.332 20.332 0 0 1 89.41 96.519l-1.194-3.21c1.58-5.441 2.606-11.374 2.606-17.61 0-5.407-.772-10.587-2.007-15.415l26.848 9.982a20.332 20.332 0 0 1 12.832 14.787 20.33 20.33 0 0 1-5.51 18.787Z" id="Shape" />
</g>
<path d="M330.027 176.293v-23.99l18.275 23.99h7.062v-37.736h-8.195v23.235l-17.681-23.235h-7.655v37.736h8.194Zm40.43.54c4.152 0 6.578-2.211 8.465-4.637v4.097h8.194v-28.895h-8.194v16.119c0 3.881-1.995 5.876-5.122 5.876-3.126 0-4.96-1.995-4.96-5.876v-16.119h-8.193v18.706c0 6.631 3.611 10.728 9.81 10.728Zm31.052-.055c2.75 0 4.744-.647 6.47-1.67v-6.578a8.334 8.334 0 0 1-4.044 1.025c-1.833 0-2.642-.917-2.642-2.804v-12.345h6.793v-7.008h-6.793v-7.385H393.1v7.385h-3.45v7.008h3.45V168.1c0 6.685 3.397 8.68 8.41 8.68Zm20.054.054c6.253 0 11.051-2.91 11.051-9.326v-.108c0-5.283-4.69-7.223-8.733-8.571-3.127-1.078-5.876-1.833-5.876-3.45v-.108c0-1.132 1.024-1.995 3.019-1.995 2.102 0 4.96 1.024 7.817 2.696l3.126-5.66c-3.126-2.103-7.116-3.343-10.781-3.343-5.822 0-10.566 3.288-10.566 9.164v.108c0 5.607 4.582 7.493 8.625 8.68 3.18.97 5.984 1.563 5.984 3.342v.108c0 1.293-1.078 2.156-3.45 2.156-2.696 0-5.984-1.186-9.11-3.45l-3.505 5.39c3.828 3.02 8.356 4.367 12.399 4.367Zm22.426-.539v-16.118c0-3.882 1.995-5.877 5.121-5.877 3.127 0 4.96 1.995 4.96 5.877v16.118h8.194v-18.706c0-6.63-3.612-10.728-9.811-10.728-4.151 0-6.577 2.21-8.464 4.636V136.94h-8.194v39.353h8.194Zm36.388.647c5.23 0 9.11-2.049 11.806-5.39l-4.69-4.152c-2.264 2.103-4.259 2.965-7.008 2.965-3.666 0-6.254-1.94-7.062-5.66h20.108c.054-.755.107-1.51.107-2.157 0-8.194-4.42-15.687-14.07-15.687-8.41 0-14.285 6.793-14.285 15.04v.108c0 8.841 6.415 14.933 15.094 14.933Zm5.283-17.358h-12.345c.647-3.72 2.857-6.146 6.253-6.146 3.45 0 5.607 2.48 6.092 6.146Zm19.946 16.711V136.94h-8.194v39.353h8.194Zm13.585 0V136.94h-8.194v39.353h8.194Z" id="NutshellWide" style="visibility:hidden" fill="#FA6400" />
</g>
</g>
</svg>
</a>
<!-- <nav>
<div class="nav-link">I WANT TO</div>
<div class="nav-link">TELL ME ABOUT</div>
<div class="nav-link">OUTAGES</div>
</nav> -->
</header>
<div class="main-body">
<div class="inner">
<p>A Dog, to whom the butcher had thrown a bone, was hurrying home with his prize as fast as he could go. As he crossed a narrow footbridge, he happened to look down and saw himself reflected in the quiet water as if in a mirror. But the greedy Dog thought he saw a real Dog carrying a bone much bigger than his own.</p>
<p>If he had stopped to think he would have known better. But instead of thinking, he dropped his bone and sprang at the Dog in the river, only to find himself swimming for dear life to reach the shore. At last he managed to scramble out, and as he stood sadly thinking about the good bone he had lost, he realized what a stupid Dog he had been.</p>
<p>It is very foolish to be greedy.</p>
</div>
</div>
@import url("https://fonts.googleapis.com/css?family=Signika+Negative:300,400&display=swap");
body {
font-family: "Signika Negative", sans-serif;
font-weight: 300;
margin: 0;
padding: 0;
position: relative;
}
.page-wrapper {
position: relative;
padding: 10px;
}
#topBar {
height: 60px;
background-color: #ffcc00;
border-bottom: 1px solid white;
}
.header {
background-color: #ffcc00;
height: 200px;
padding: 10px;
//position: fixed;
position: relative;
top: 0;
left: 0;
right: 0;
&--scrolled {
background-color: red;
position: fixed;
top: 0;
left: 0;
right: 0;
}
a.brand {
width: 500px;
height: 200px;
svg {
height: 100%;
width: auto;
}
}
nav {
}
}
.main-body {
margin-top: 10px;
height: 1000vh;
background: #f1f1f1;
padding: 80px;
.inner {
max-width: 600px;
font-size: 20px;
line-height: 140%;
}
}
// gsap.to()... infinity and beyond!
// For more check out greensock.com
let tl = gsap.timeline();
gsap.set("#bee", { transformOrigin: "bottom left" });
gsap.set("#NutshellWide", { y: -10 });
tl.to("#bee", { y: 20, x: 10, scale: 0.5 })
.to("#Nutshell", { y: 50, autoAlpha: 0 }, "<")
.to("#mainHeader", { height: 100 }, "<")
.to("#NutshellWide", { autoAlpha: 1, y: 0 }, "<")
.paused(true);
ScrollTrigger.create({
start: 60,
end: 200,
markers: true,
scrub: 1,
animation: tl,
//toggleClass: { className: "header--scrolled", targets: "#mainHeader" }
onEnter: () => {
document.querySelector("#mainHeader").classList.add("header--scrolled");
},
onLeaveBack: () => {
document.querySelector("#mainHeader").classList.remove("header--scrolled");
}
});
Also see: Tab Triggers