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 class="container">
<div class="pin-animation">
<div class="pin-animation__wrapper">
<div class="slide-left">
text sliding from Left
</div>
<div class="slide-right">
Text slides from Right
</div>
</div>
</div>
<div class="text-wrapper">
<div class="left-content">
This is sticky title
</div>
<div class="right-content">
Monkey D. Luffy, also known as "Straw Hat Luffy" and commonly as "Straw Hat",[11] is the main protagonist of the manga and anime, One Piece. He is the founder and captain of the increasingly infamous and powerful Straw Hat Pirates, as well as the most powerful of its top fighters.[27][28] He desires to find the legendary treasure left behind by the late Gol D. Roger and thereby become the Pirate King,[29] which would help facilitate an unknown dream of his that he has told only to Shanks, his brothers and crew.[30][31] He believes that being the Pirate King means having the most freedom in the world.[32]
Born in Foosha Village, Luffy is the son of Monkey D. Dragon, the leader of the Revolutionary Army,[33] and the grandson of the Marine hero Monkey D. Garp,[34] and their family carries the initial and Will of D.[33] Luffy met "Red-Haired" Shanks, who gave Luffy the very straw hat that has become Luffy's signature accessory, having gifted it to the boy as part of a promise for them to meet again someday after he became a great pirate.[35] Growing up on Dawn Island, Luffy befriended and became sworn brothers of the late "Fire Fist" Portgas D. Ace[36] and Revolutionary Chief-of-Staff Sabo,[37] as well as being raised under the care of Curly Dadan.[38]
Luffy accidentally ate the Gomu Gomu no Mi at age 7, which turned his body into rubber.[39] Thanks to his strong imagination, Luffy is able to wield the seemingly unthreatening abilities of his Devil Fruit to act as an incredibly competent fighter, often manipulating his own rubbery body into a variety of powerful forms. He is one of few individuals known to have awakened his Devil Fruit, which bestows him with mythical power.[26] In addition to his Devil Fruit abilities, Luffy is one of few individuals capable of wielding all three forms of Haki and has mastered them to the point that he has developed advanced abilities
Luffy has gone up against numerous global powers around him, starting with fighting the most powerful pirates in the East Blue and moving to clashes against the Marines, Seven Warlords of the Sea, Cipher Pol, World Nobles, and even the Four Emperors of the Grand Line, emerging victorious in a majority of these battles. He invaded and indirectly caused the annihilation of Enies Lobby, escaped the impregnable Impel Down, and was a focal figure in the Summit War of Marineford. He has also either defeated or befriended seven of the eleven known past or present Warlords prior to the organization's dissolution. Furthermore, Luffy has invaded the territory of the Four Emperors on multiple occasions, and eventually managed to defeat one. Luffy's accomplishments and heritage have caused him to be labeled as a "Dangerous Future Element" while in the process gaining a reputation for being "reckless" and, in some cases, "insane," earning the wrath of Fleet Admiral Sakazuki, the Marine Headquarters, and even the World Government.[40]
</div>
</div>
</div>
* {
margin: 0;
padding: 0;
}
.text-wrapper {
display: flex;
font-size: 24px;
}
.left-content {
width: 30%;
}
.right-content {
width: 70%;
}
.pin-animation {
height: 50vh;
background: tomato;
&__wrapper {
height: 100%;
width: 100%;
display: flex;
justify-content: center;
align-items: center;
flex-direction: column;
}
}
ScrollTrigger.create({
trigger: ".pin-animation",
start: "top top",
end: "+=1000",
pin: ".container"
})
ScrollTrigger.create({
trigger: ".text-wrapper",
start: "top top",
end: "bottom bottom",
pin: ".left-content",
pinnedContainer: ".container",
markers: true
})
Also see: Tab Triggers