Conceal CSS Animation overflow content

I've been working on creating an animation, and I'm almost finished with it. The issue I'm encountering is that the horizontal and vertical scrollbars are refusing to disappear. I attempted adding the overflow:hidden property to the parent div (.box), but unfortunately, I have not been successful in hiding them.

<!DOCTYPE html>
<html lang="en">
  <head>
    <meta charset="UTF-8" />
    <meta http-equiv="X-UA-Compatible" content="IE=edge" />
    <meta name="viewport" content="width=device-width, initial-scale=1.0" />
    <title>Document</title>
    <style>
      
      .box {
        display: flex;
        justify-content: center;
        align-items: center;
        height: 100vh;
        width: 100vw;
        overflow: hidden;
      }
      .rotor1 {
        height: 100vw;
        background: rgb(152, 227, 250);
        animation: 9.2s keepRotating infinite ease-in-out;
        z-index: 3;
      }
      .rotor2 {
        height: 102vw;
        background: rgb(204, 238, 248);
        border-radius: 30%;
        animation: 9.05s keepRotating infinite ease-in-out;
        animation-timing-function: linear;
      }
      .rotor1,
      .rotor2 {
        width: 110vw;
        position: absolute;
        top: -78vw;
        border-radius: 30%;
        animation-timing-function: linear;
      }

      @keyframes keepRotating {
        from {
          transform: rotate(0deg);
        }
        to {
          transform: rotate(360deg);
        }
      }
    </style>
  </head>
  <body>
    <div class="box">
      <div class="rotor1"></div>
      <div class="rotor2"></div>
    </div>
  </body>
</html>

Does anyone know of a method to hide both the horizontal and vertical scrollbars effectively?

Answer №1

To implement a hidden overflow on the body tag, use the CSS property overflow: hidden;

<!DOCTYPE html>
<html lang="en">
  <head>
    <meta charset="UTF-8" />
    <meta http-equiv="X-UA-Compatible" content="IE=edge" />
    <meta name="viewport" content="width=device-width, initial-scale=1.0" />
    <title>Web Page</title>
    <style>
         body{
          overflow: hidden;
          }
        .box {
        display: flex;
        justify-content: center;
        align-items: center;
        height: 100vh;
        width: 100vw;
        overflow: hidden;
      }
      .rotor1 {
        height: 100vw;
        background: rgb(152, 227, 250);
        animation: 9.2s keepRotating infinite ease-in-out;
        z-index: 3;
      }
      .rotor2 {
        height: 102vw;
        background: rgb(204, 238, 248);
        border-radius: 30%;
        animation: 9.05s keepRotating infinite ease-in-out;
        animation-timing-function: linear;
      }
      .rotor1,
      .rotor2 {
        width: 110vw;
        position: absolute;
        top: -78vw;
        border-radius: 30%;
        animation-timing-function: linear;
      }

      @keyframes keepRotating {
        from {
          transform: rotate(0deg);
        }
        to {
          transform: rotate(360deg);
        }
      }
    </style>
  </head>
  <body>
    <div class="box">
      <div class="rotor1"></div>
      <div class="rotor2"></div>
    </div>
  </body>
</html>

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

Tips for limiting the .click function to only the initial image in order to prevent loading all images within the container

I am facing a situation where multiple images are being returned into a specific div, which is working as intended. <div class="go" id="container"></div> Upon clicking on an image, it is loaded into a modal popup. However, instead of capturin ...

What could be the reason for the lack of styling on the select element when using PaperProps in the MenuProps of my Select component?

I've been struggling to remove the white padding in this select box for a while now. I've tried countless variations and places to tweak the CSS with no success. Any suggestions on how to make it disappear? The project is using MUI 5, and I even ...

Retrieving User ID for Updating in MySQL using PHP

My current dilemma involves updating specific entries in my database using a PHP form. The issue arises when I try to only update an entry with a particular ID. Let me break down the problem: In my database, I have a table of users. When I choose to edit ...

Display a customized hyperlink in HTML

I have a query regarding embedding HTML data in my own domain link. I want to set it up so that when I open the link, a webpage displays with the HTML script without requiring me to download the HTML file directly. I believe this can be achieved using a P ...

Ensure your mobile site is optimized for full width display

Imagine a webpage with a fixed width of 1280px. Is there a way to instruct a smartphone to automatically scale this page to full width upon loading? Currently, I am using: <meta name="viewport" content="width=1280, initial-scale=1"> However, it d ...

How do you prevent overlapping divs from being clickable in order to access content below?

Currently, I am utilizing a JPG overlay with decreased opacity for a particular effect. However, I am interested in keeping it solely as an aesthetic effect and making the content beneath that division clickable. Do you think this is achievable? Thanks! I ...

Navigate only within the tbody section of the Material UI Table by scrolling

Utilizing the material-ui Table component to build a table with a sticky header presents a challenge. The default behavior is for the scroll to encompass both the thead and tbody of the table. However, I specifically require the scroll functionality to be ...

Is it possible to merge two classes in CSS together?

Struggling to merge two CSS classes, I attempted with the following code: .container{ .ningbar } Hoping to unite the elements of both the ningbar and container layers. Any advice would be greatly appreciated. Thank you, Phineas. ...

When utilizing jQuery lightbox to pull data from a database using PHP/Ajax, it may require a double click the

Encountering a strange issue where I must click on specific buttons with unique IDs. These IDs are then sent through Ajax to a PHP script, which searches for corresponding entries in the database. The retrieved data is then displayed in a jQuery lightbox. ...

What is the best way to make one div show that another div is being toggled in a slideshow display?

I am searching for a solution to indicate when a div is being toggled, using a separate div with the class of ".bars". Experimented with if statements and modifying classes on the indicator div ".bars" to adjust its characteristics... The ".bars" indicat ...

What is the best way to incorporate keyboard shortcuts into carousel operations using jQuery?

The example can be found here. I want to be able to navigate through the images using the left and right arrows on my keyboard. How can I achieve this using jQuery or CSS? This is the structure of the HTML: <div id="slider-code"> <a cla ...

Overlapping input elements occur when Twitter bootstrap prepended input elements are positioned side by side

I ran into an issue while attempting to place two input elements side by side, with a prefixed item on the first input, using display:table styles. Unfortunately, the second input element ends up overlapping the first. I tried using box-sizing: border-box ...

Displaying HTML code as plain text using NodeJS

I need to display text that contains HTML tags (for example: "This is a <p> tag") without my nodeJS page interpreting them as real "<p></p>" tags. How can I achieve this? If I try using the &lt; and &gt; HTML entities, they are n ...

In Internet Explorer, the list items are overlapping, while functioning perfectly in all other web browsers

I've encountered a strange issue with my list item in Internet Explorer. Despite working perfectly in Chrome and other browsers, it fails to function properly in IE. I've built this application using the Vue framework and have faced various probl ...

Aligning elements vertically in Bootstrap 4 with the power of flexbox

Seeking assistance with a frustrating issue in Bootstrap 4: I tried to implement the align-self-start flexbox alignment using the code from this page . However, the example provided on that page does not seem to work. Is there a simpler way to achieve the ...

What can be done to resolve the issue of text not displaying correctly on the screen?

I am attempting to position text to the right of a card header in my project, but for some reason the working example on fiddle is not working. I am using Bootstrap 4. Check out the example here. Here is what I am seeing in my app: https://i.sstatic.net ...

Storing the background color in a JavaScript variable

I've been experimenting with creating a fade in and out effect for a background image on a website. I've also been attempting to capture the background color of a div and store it in a variable. Here's what I have tried: elem = document.ge ...

Utilize Bootstrap in an Angular template to effortlessly expand one element while collapsing all others

I'm facing an issue with a table in my component. Each row has a button that, when clicked, should expand to show some calculated data specific to that row. However, the problem is that when one button is expanded, it keeps other buttons expanded as w ...

What is the best way to position a div at the bottom of the main div?

How can I position a div with the class "boxLinks" at the bottom of the main box with the class "main-box"? Here's my idea: The main class has a width of 1200px; within this main class, there are 5 divs with each div having a width of 25%. .main- ...

Insert fresh div elements chronologically using jQuery

When a user clicks on the ".u-post-button" button, this script is triggered. It retrieves the content of the comment input field and posts it to the server as a JSON object. The returned data containing the comment information is then appended after the ...