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 Skypack, which makes packages from npm not only available on a CDN, but prepares them for native JavaScript ES6 import
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.
<article>
<p><strong>Hey girl</strong></p>
<p>Hey girl, I brought home a few bottles of wine since I know you needed more corks for that pinterest project. Then, telling Derek Cianfrance that I'd ever I could rob a bank I'd do it on my motorcycle, and he said 'That's weird, I just wrote a script
about that'. I drive. I wrote you 365 letters. I wrote you everyday for a year.</p>
<p>I drive. Anything happens a minute either side of that, and you're on your own. I think like a girl, I think. Anything happens in that five minutes, then I'm yours, no matter what. I don't sit in while you're running it down.</p>
<p><strong>I love being Canadian</strong></p>
<p>I love being Canadian. I think growing up in Canada gives you a world perspective that I certainly enjoy. I think like a girl, I think. I hear about actors who become the role and I think 'I wonder what that feels like'. We're always changing. In most
movies you spend so much time looking for any scraps of truth, and in this movie you're just marinating in it.</p>
<p>Anything happens in that five minutes and I'm yours. You tell me where we start, where we're going, where we're going afterwards. Then, telling Derek Cianfrance that I'd ever I could rob a bank I'd do it on my motorcycle, and he said 'That's weird, I
just wrote a script about that'. I hear about actors who become the role and I think 'I wonder what that feels like'. You have a shelf life as an actor, so you have to find another way to express yourself.</p>
<p><strong>I wrote you 365 letters</strong></p>
<p>I wrote you 365 letters. Anything by Disney makes me cry. I could be pensive, uhh... smart, supersticious, brave? And I, uhh, I can be light on my feet. I went through puberty in a theme park. You just tell me what you want, and I'm gonna be that for
you.
</p>
<p>You just have to hang out in places that are more interesting than you are. I love being Canadian. I think growing up in Canada gives you a world perspective that I certainly enjoy. You tell me where we start, where we're going, where we're going afterwards.
I could be pensive, uhh... smart, supersticious, brave? And I, uhh, I can be light on my feet. I won't eat my cereal.</p>
<p><strong>I could be whatever you want</strong></p>
<p>I could be whatever you want. I try not to make too many movies. Anything happens in that five minutes and I'm yours. It just felt meant to be. There would be no cuts, real people in there, real tellers.</p>
<p>I don't know enough about manliness to define it. If ever I try to predict, I'm sure I will be instantly humbled. My character seems to think that he is, so he would define it. I think the one thing I love most about being an adult is the right to buy
candy whenever and wherever I want. But everytime that happens, what do you get? You get a new day.</p>
<p><strong>I wrote you everyday for a year</strong></p>
<p>I wrote you everyday for a year. I'm really not good at knowing what people want, because don't have that talent. I get sick of myself, so I can imagine how everyone else feels. I'm not a good enough actor to become a character. I want all of you, forever,
everyday. You and me...everyday.</p>
<p>I don't carry a gun. I think the one thing I love most about being an adult is the right to buy candy whenever and wherever I want. But everytime that happens, what do you get? You get a new day. I love being Canadian. I think growing up in Canada gives
you a world perspective that I certainly enjoy. It feels like not that long ago that I was on a show called 'Young Hercules' in which I had a fake tan and wore tight leather pants and fought imaginary monsters.</p>
<p><strong>You have a shelf life as an actor</strong></p>
<p>You have a shelf life as an actor, so you have to find another way to express yourself. Anything happens in that five minutes and I'm yours. I think the one thing I love most about being an adult is the right to buy candy whenever and wherever I want.
If ever I try to predict, I'm sure I will be instantly humbled. I won't eat my cereal.</p>
</article>
<img class="rygo" src="https://pngimage.net/wp-content/uploads/2018/06/ryan-gosling-png-4.png" alt="">
.rygo {
bottom: -500px;
position: fixed;
right: 0;
width: 500px;
}
const rygo = document.querySelector(".rygo");
const rygoStylin = window.getComputedStyle(rygo);
const startPos = parseInt(rygoStylin.getPropertyValue("bottom"), 10);
const stopPos = 0;
const rygoDance = () => {
let scrollPercent =
window.pageYOffset /
(document.documentElement.scrollHeight -
document.documentElement.clientHeight) *
100;
let scrollPos = scrollPercent * (stopPos - startPos) / 100 + startPos;
rygo.style.bottom = `${scrollPos}px`;
};
window.addEventListener("scroll", rygoDance, false);
Also see: Tab Triggers