Pen Settings

HTML

CSS

CSS Base

Vendor Prefixing

Add External Stylesheets/Pens

Any URL's added here will be added as <link>s in order, and before the CSS in the editor. If you link to another Pen, it will include the CSS from that Pen. If the preprocessor matches, it will attempt to combine them before processing.

+ 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

Save Automatically?

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

              
                <!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <title>Видео на весь экран и крутой эффект скролла.</title>
    <link rel="stylesheet" href="style.css">
</head>
<body>

    <header>
        <video src="https://antonaniskovich.ru/images/html-i-css/2020/2020-03-30-video-na-ves-ekran-s-zatuhaniem-pri-skrole/file/1.mp4" autoplay muted loop></video>
  </header>

    <section>
        <div class="content">
            <h2>Видео на весь экран и крутой эффект скролла.</h2>
            <p>Lorem ipsum dolor, sit amet consectetur adipisicing elit. Adipisci maiores quibusdam quod aperiam iure eveniet voluptatibus ipsum, dicta, est asperiores ratione! Voluptas fuga provident est quo earum, ipsa cumque at corporis maiores expedita eligendi harum veniam, minima tempora ipsum in. Non in omnis molestias dolores minima, sit nulla modi error mollitia cum! Quod reprehenderit cum iusto minima aliquam laborum excepturi, provident exercitationem fugit hic nesciunt, velit illo omnis ratione temporibus saepe? Repudiandae pariatur doloribus, labore sequi, harum iusto ut ratione magni non explicabo quaerat nobis officia enim veritatis, architecto debitis odio maxime quas dolores voluptate tenetur? Officiis eligendi ex ipsum nostrum consequatur, excepturi laudantium beatae sit exercitationem rem voluptates nulla obcaecati dignissimos! Est facere animi at veniam ipsum quibusdam, pariatur incidunt tempore earum reiciendis iure neque repellat molestiae doloremque! Atque magni dolor nisi labore repudiandae qui consequatur neque beatae, quae ab quia perferendis repellendus totam. Consectetur officiis adipisci vel suscipit, aperiam repudiandae dignissimos repellat repellendus quam asperiores deleniti perferendis maiores nihil fugit cum aut, voluptates expedita corporis odit amet similique veritatis veniam sequi. Illum obcaecati laborum similique optio perferendis minus nam dolorum nobis soluta eveniet amet excepturi itaque sint ipsa dicta deserunt, provident consequuntur earum odio quia aperiam! Odio, ad.</p>
        </div>
    </section>

    <script src="script.js"></script>
</body>
</html>
              
            
!

CSS

              
                *{
    padding: 0;
    margin: 0;
    box-sizing: border-box;
    font-family: roboto, sans-serif;
}

body{
    background-color: yellowgreen;
    color: darkolivegreen;
}

header{
    position: relative;
    width: 100%;
    min-height: 100vh;
    display: flex;
    justify-content: center;
    align-items: center;
    overflow: hidden;
    padding: 100px;
}

section{
    min-height: 100vh;
    padding: 60px;
}

video{
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    object-fit: cover;
    pointer-events: none;
}

h2{
    font-size: 3em;
    margin-bottom: 20px;
}

p{
    font-size: 1.2em;
}
              
            
!

JS

              
                let video = document.querySelector('video');

window.addEventListener('scroll', function(){
    let value = 1 + window.scrollY/-600;
    video.style.opacity = value;
});
              
            
!
999px

Console