Pen Settings

HTML

CSS

CSS Base

Vendor Prefixing

Add External Stylesheets/Pens

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.

+ add another resource

JavaScript

Babel includes JSX processing.

Add External Scripts/Pens

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.

+ add another resource

Packages

Add Packages

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.

Behavior

Auto Save

If active, Pens will autosave every 30 seconds after being saved once.

Auto-Updating Preview

If enabled, the preview panel updates automatically as you code. If disabled, use the "Run" button to update.

Format on Save

If enabled, your code will be formatted when you actively save your Pen. Note: your code becomes un-folded during formatting.

Editor Settings

Code Indentation

Want to change your Syntax Highlighting theme, Fonts and more?

Visit your global Editor Settings.

HTML

              
                <!-- 普通のアニメーション -->
<section>
 <h2>animation</h2>
 <p>Far far away, behind the word mountains, far from the countries Vokalia and Consonantia, there live the blind texts. Separated they live in Bookmarksgrove right at the coast of the Semantics, a large language ocean. A small river named Duden flows by their place and supplies it with the necessary regelialia. It is a paradisematic country, in which roasted parts of sentences fly into your mouth. Even the all-powerful Pointing has no control about the blind texts it is an almost unorthographic life One day however a small line of blind text by the name of Lorem Ipsum decided to leave for the far World of Grammar. The Big Oxmox advised her not to do so, because there were thousands of bad Commas, wild Question Marks and devious Semikoli, but the Little Blind Text didn’t listen. She packed her seven versalia, put her initial into the belt and made herself on the way. When she reached the first hills of the Italic Mountains, she had a last view back on the skyline of her hometown Bookmarksgrove, the headline of Alphabet Village and the subline of her own road, the Line Lane. Pityful a rethoric question ran over her cheek, then...</p>
</section>

<!-- 視差効果 装飾 -->
<div class="parallax">
 <img src="https://nnc-studio.jp/wp-content/uploads/2024/04/swan.png" alt="" class="swan">
 <img src="https://nnc-studio.jp/wp-content/uploads/2024/04/rocket.png" alt="" class="rocket">
</div>
              
            
!

CSS

              
                .parallax img {
    position: absolute;
    z-index: 100;
    display: block;
    width: 100px;
}

.swan {
    right: 40px;
    top: 400px;
    /* アニメーションの命令 */
    animation: swanAnime ease-in-out;
    animation-timeline: view();
    animation-range: cover;
}

@keyframes swanAnime {
    0% {
        right: 40px;
    }

    10% {
        right: 80px;
    }

    20% {
        right: 120px;
    }

    30% {
        right: 160px;
    }

    40% {
        right: 200px;
    }

    50% {
        right: 240px;
    }

    60% {
        right: 280px;
    }

    70% {
        right: 320px;
    }

    80% {
        right: 360px;
    }

    90% {
        right: 400px;
    }

    100% {
        right: 440px;
    }
}

.rocket {
    left: 40px;
    top: 100vh;
    /* アニメーションの命令 */
    animation: rocketAnime linear forwards;
    animation-timeline: view();
    animation-range: cover;
}

@keyframes rocketAnime {
    0% {
        top: 100vh;
    }

    25% {
        top: 75vh;
    }

    50% {
        top: 45vh;
    }

    75% {
        top: 25vh;
    }

    100% {
        top: 0vh;
    }
}

/* レイアウトのためのCSS */

body {
  height: 800px;
  position: relative;
}

section {
    background-color: #fff;
    width: 80%;
    margin-left: auto;
    margin-right: auto;
    padding: 40px;
    border: 3px solid #333;
    border-radius: 20px;
    margin-bottom: 80px;
}

h2 {
    text-align: center;
    font-size: 20px;
    margin-bottom: 20px;
    padding-bottom: 5px;
    border-bottom: 3px solid #333;
}
              
            
!

JS

              
                
              
            
!
999px

Console