Can you identify which CSS style is being used here?

Recently, I stumbled upon an intriguing sticky video background effect while browsing the internet.

Now, my goal is to recreate this effect on my own website. However, getting started has proven to be quite challenging without knowing the proper name of the effect.

If you take a look at this video: , you will see exactly what I'm referring to.

I have a couple of questions that could guide me in accomplishing my task:

Q1. What is the specific name of this captivating effect? Q2. Can this effect be achieved solely using CSS?

Answer №1

Well, well, well, that is quite an intriguing inquiry. In terms of the parallax effect, I believe it goes by the name of a "sticky" background. And as for the method used to achieve this, it appears to be something along these lines...

<div class="video-bg-spacer">
//A blank div with a see-through background acting as a "view window" for the video
</div>
//Towards the end of your code...
<div class="video-container">
    <video class="background-video" autoplay="autoplay" loop="loop" muted="muted">
      <source src="http://www.w3schools.com/html/mov_bbb.mp4" type="video/mp4"/>
      <source src="http://www.w3schools.com/html/mov_bbb.ogg" type="video/ogg"/>
    </video>
</div>

The styling for the background video will look something like this:

.background-video {
  height: 100%;
  margin: 0 auto;
  position: fixed;
  z-index: -100;//beneath everything else
  background-attachment: fixed;
  top: 0;
  left: 0;
}
.video-bg-spacer {
   background: transparent;
   height: 100vh;
}

Take a gander at this example.

https://codepen.io/jacob_124/pen/QvRLXG?editors=0100

I have thoroughly examined the code from the demonstrated instance and indeed, this is how they pull it off... Placing your video content at the bottom ensures that all images on your page load before the video itself.

Answer №2

The parallax effect you're trying to achieve isn't quite there yet. The background image remains stationary while the front panel is simply being scrolled up and down.

Similar questions

If you have not found the answer to your question or you are interested in this topic, then look at other similar questions below or use the search

Using jQuery.ajax and not retrieved using a GET request

I'm attempting to extract the value (adults) from a select option field using a GET request with AJAX. I am able to extract the value from the URL by displaying an alert with the URL in the jQuery function. However, I am unable to retrieve the value w ...

How to use image blob in Angular JS?

Working with API endpoints that require authentication for image retrieval. Utilizing a service called authenticatedHttp as an abstraction over $http to manage authentication tokens successfully. Successfully receiving response, converting blob to object ...

Is there a way to display the second array that originated from the string after using the .split() method

Presented here is a string: a = "This is just an example"; If the following was used: split(" ",1) The function would divide and print the first word as an array. The question at hand is, how can I split the second string into an arr ...

Canvg | Is there a way to customize canvas elements while converting from SVG?

Recently, I encountered an issue with styling SVG graphics dynamically generated from data. The SVG graphic appears like this: https://i.sstatic.net/xvIpE.png To address the problem, I turned to Canvg in hopes of converting the SVG into an image or PDF us ...

Progressive rendering of particles in THREE.js

I am new to the world of 3D and I'm trying to render particles as they are created. My goal is to have these 2000 particles render individually as they are created, but with the current code, they only render once all particles have been created. I h ...

Why is it that a click event outside of an HTML element cannot be detected in this Vue 3 application?

I've been diving into building a Single Page Application using Vue 3, TypeScript, and The Movie Database (TMDB). Currently, I'm focused on developing a search form within my project. Within the file src\components\TopBar.vue, here&apo ...

When using Three.js, adjusting the TranslateX or Y values sometimes results in unexpected rotation instead of a straightforward movement along the axis,

In my Three.js project with TrackballControls, I am working on creating a dynamic 3D scene. One of the key components is the PerspectiveCamera that I have initialized: camera = new THREE.PerspectiveCamera(40, window.innerWidth / window.innerHeight, 1, 10 ...

Guide for using two Async Pipe functions in Angular 7

Two different functions are in place to check a specific condition, and the requirement is for both of them to be true simultaneously. How can *ngIf be utilized to achieve this? Currently, setting just one of them works, but the aim is to have both. HTML ...

Is there a way to view an image before and after uploading it?

I am encountering an issue while attempting to display a preview of an image in a form. The HTML code involved is as follows: <form action="" method="post" enctype="multipart/form-data" name="personal_image" id="newHotnessForm"> <p><lab ...

Arrange a set of items using AngularJS according to specific criteria

Hello, I'm new to Angular I've created an angular app and you can view it in this plunkr. Can someone guide me on how to sort the list displayed here using angular? I want the course with the flag to always stay on top, while sorting the rest o ...

Having difficulty communicating with the smart contract using JavaScript in order to retrieve the user's address and the balance of the smart contract

Hi there, I am a newcomer to the world of blockchain technology. Recently, I created a smart contract designed to display both the contract balance and user data, including the address and balance of the user. The smart contract allows users to deposit fun ...

Is there a way to verify if an HTML popover is currently displayed?

Is there a method using JavaScript to determine if the popover is open when utilizing the new popover API? <button popovertarget="pop">Trigger the popover</button> <div popover id="pop">This is the content of the popover!</div> ...

alter the property of the vec2 variable

In my vertex shader, I am attempting to alter the attribute vec2 a_position variable that is also used in the fragment shader. This modification is intended to achieve a cylindrical projection of an image. Here is the code snippet from my shaders: <! ...

Trouble displaying REACT.jsx in browser

I'm currently learning React and struggling to get it running smoothly. HTML function Person(){ return ( <div class="person"> <h1>Max</h1> <p>Your Age: 28</p> </div> ); } ...

Incorporating S3 images into vanilla JavaScript within a Django storages environment

I am facing a simple issue that I cannot seem to resolve. I have configured Django storages to serve static files from S3. In my template, I define the image source like this: "{% static 'fun_share/img/logo/logo.svg' %}" with STATIC_UR ...

Using jQuery to create dynamic elements that fade out with timers

My website has a simple message system that displays messages in a floating div at the top of the page. Each message is supposed to fade out after a certain amount of time, but I want users to be able to pause the fading process by hovering over the messag ...

Numbered keys in JSON

I'm dealing with a JSON object that is passed to a script, and the keys are dynamic which makes it hard for me to access the data. The keys in the JSON object are actually numbers, but no matter how I try to access them, I can't seem to get the ...

Unable to retrieve JSON data at this time

I am currently attempting to retrieve information from a JSON file using JQuery in my HTML code with the following script: $.getJSON( "en.json", function( data ) { console.log(data.age); }); Unfortunately, it doesn't seem to be working as expe ...

Safari keyframe animation causing wobbly off-center rotation

When viewed on Safari, the spinning animation appears off-center. How can this issue be resolved? The CSS code responsible for the animation is as follows: html, body { height: 100%; } body { background: #a6b8b1; display: grid; place ...

Verification of phone numbers in HTML

Currently, I am facing a dilemma while working on an HTML website. The client's requirement is to allow only numerical phone numbers without any alphabetic characters. The condition set is that the phone number field should accept and submit a phone ...