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.
<!--
■scrollifyがjsで使うクラス名です。
■scrollifyでなくても任意のクラス名で大丈夫です。
-->
<div class="container">
<section class="section01 scrollify">
<div class="title">SECTION01</div>
<div class="content">Once upon a time,<br>Cinderella had a step-mother and two step-sisters move into her house.<br>Each of them was cruel, and every day they did mean things to Cinderella.<br><br>One day, an invitation to a ball was delivered.<br>“You have to stay home!”<br>said her step-mother and step-sisters as they left.<br><br>As Cinderella was left crying, her Fairy Godmother appeared<br>and said, “I am going to help you.”<br>With a sparkle of her magic wand<br><br>a beautiful dress and a pumpkin carriage appeared!<br>“This magic will only last until midnight,” said the Fairy Godmother,<br><br>lastly giving her a pair of glass slippers.<br><br>When Cinderella arrived at the castle,<br>a handsome prince came up to her<br>and asked, “May I have this dance?”<br>The two of them were getting along wonderfully,<br><br>when “Bong!”<br>The clock struck midnight!<br><br>Cinderella rushed away to get home,<br>but lost one of her glass slippers on the stairs.<br><br>The next day, a servant from the castle came to the house.<br>“The Prince will marry whoever owns this glass slipper.”<br><br>“It’s mine! It’s mine!”<br>lied the two step-sisters.<br>But their feet were too big to fit!<br><br>Cinderella, of course, was a perfect fit.<br><br>Cinderella married the Prince<br>and they had a wonderful life together,<br>living happily ever after.
</div>
</section>
<section class="section02 scrollify">
<div class="title">SECTION02</div>
</section>
<section class="section03 scrollify">
<div class="title">SECTION03</div>
</section>
<section class="section04 scrollify">
<div class="title">SECTION04</div>
</section>
</div>
/* scrollify.jsに関係する記述はここかから */
.scrollify{
width: 100%;
height: 100vh;
}
.section01{
background-color: #ff7575;
}
.section02{
background-color: #75ff75;
}
.section03{
background-color: #ffff75;
}
.section04{
background-color: #75baff;
}
/* scrollify.jsに関係する記述はここまで */
/* セクションごとのタイトルはここから */
.title{
font-size: 36px;
font-family: 'Oswald', sans-serif;
letter-spacing: 0.1rem;
margin-left: auto;
margin-right: auto;
padding-top: 70px;
width: fit-content;
width: -moz-fit-content;
width: -webkit-fit-content;
}
.content{
font-size: 16px;
font-family: 'Oswald', sans-serif;
margin-left: auto;
margin-right: auto;
margin-top: 30px;
line-height: 1.5;
padding-bottom: 50px;
text-align: justify;
width: fit-content;
}
/* セクションごとのタイトルはここまで */
$.scrollify({
section:'.scrollify', //対象要素を指定
easing: 'swing', // イージングを指定
scrollSpeed: 600, // スクロール時の速度
updateHash: false, // スクロール時アドレスバーのURLを更新
standardScrollElements: '.section03,.section04', //通常スクロール要素
});
Also see: Tab Triggers