Ways to create a transparent parallax background

Currently, I'm tasked with developing an educational website using HTML and CSS for a school project. Unfortunately, due to restrictions on code.org, I cannot utilize JavaScript files or script tags. Despite successfully implementing a parallax effect, the main issue lies in the fixed background image being duplicated on the scrolling page. You can view the website by clicking on the link provided below.

Project Link

When scrolling, the page moves up with a duplicate background. My goal is to make this background transparent.

body {
  background-image: url(paper.jpg);
  font-family: 'Kalam';
}

p {
  color: black;
  font-size: 20px;
}

h1 {
  font-weight: bold;
}

.parallax {
  background-image: linear-gradient();
  min-height: 600px;
  background-attachment: fixed;
  background-position: center;
  background-repeat: no-repeat;
  background-size: cover;
}

.glow {
  font-size: 32px;
  color: #000000;
  text-align: center;
  animation: glow 1s ease-in-out infinite alternate;
}

@-webkit-keyframes glow { ... }

li {
  font-size: 2
}
<!DOCTYPE html>...</html>

If anyone could offer assistance, it would be immensely appreciated. Thank you, Randy

I've attempted to remove the background using background-color: transparent;, but it reverts the page to standard scrolling functionality. Adjusting opacity has also proven unsuccessful as it disrupts the parallax effect.

Answer №1

Relocate all the content within the

<div class="parallax">
to set them as the background of the website.

If you prefer to keep them lower on the page, create a new element above them to occupy the space.

<html>
  <head>
    <link href='https://fonts.googleapis.com/css?family=Kalam' rel='stylesheet'>
    <link rel="stylesheet" href="style.css">
    <meta name="viewport" content="width=device-width, initial-scale=1">

    <title>TikTok Better</title>
  </head>
  <body>
    <div class="parallax">

        add a div here that fills in the space 


        <center>
      <h1 class="glow">
        <img src="giphy.gif" alt="TikTok Logo" style="float:right;width:80px;height:80px;">
        <img src="Youtube_shorts_icon.png" alt="Smiley face" style="float:left;width:45px;height:50px;">
        Why YouTube shorts sucks
      </h1>
    </center>


    <h2>Reasons:</h2>
    <ol>
      <li>It's a ripoff of TikTok.</li>
      <li>Its clearly the same layout and function of TikTok.</li>
      <li>The videos are outdated.</li>
      <li>The videos suck.</li>
    </ol>
    <h2>Memes</h2>
    <ul>
      <p>   
        <li>
          <b>YouTube: </b>They're all clearly outdated by at least 1 year. Most them aren't even funny.
        </li>
      </p>

      <p>
        <li>
          <b>TikTok: </b>The memes are all up to date and funny.
        </li>
      </p>
    </ul>
    <h2>Layout</h2>
    <ul>
      <p>
      </p><li>
      <b>YouTube: </b>Just hideous. Basically exactly the same as TikTok with minimal differences. The like button and live streams are all there.
      </li>
      <p></p>
      <p>
      </p><li>
      <b>TikTok: </b>The original nice and easy look. Everything is in thumb reach and is in dark mode so it's easy on your eyes.
      </li>
      <p></p>
    </ul>
    <h2>People On The Platform</h2>
    <ul>
      <p> 
        <li>
          <b>YouTube: </b> Random people getting views off clickbait and whatnot
        </li>
      </p>
      <p>  
        <li>
          <b>TikTok: </b> All respected people like music artists and others.
        </li>
      </p>
    </ul>
    <h2>Further Explanation</h2>
    <p>We can clearly see that YouTube Shorts was created after TikTok. All the videos are also super boring and most of them use outdated memes. Check out this link for a comparison: 
      <a href="https://nationalpositions.com/youtube-shorts-vs-tiktok-whats-the-difference/">Comparison</a>. 
      There is a very nice video explaining if YouTube should stop making shorts. It gives opinions on both sides with clear and concise detail. Take a look: <a href="https://www.youtube.com/watch?v=BaETvTFJ4rc">Opinions.</a>
    </p>   
    </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

Is there a method to use media queries to dynamically switch JavaScript files based on the user's device?

I've been working on optimizing the mobile layout of my website, and while I have successfully implemented a media query with a different stylesheet for mobile devices, I'm struggling to determine if it's feasible to also load a separate Jav ...

Guide on adding animation to an image in Bootstrap when hovering with the mouse

Is there a way to add animation to an image on my website when hovering over it without using CSS? Are there any specific bootstrap classes that allow for direct animations on elements? ...

jQ identifying children with particular styling attributes

I am attempting to locate a child element that meets the following conditions: CSS visibility set to visible and CSS class assigned as foo There will always be only one element that meets these criteria at any given time var visibleBox = $('#parentE ...

Tips for applying a class to an element depending on data stored in Local Storage using JQuery

I am currently working on a TODO list project with functions to save and delete records already in place. However, I am facing challenges with the functions for marking items as important and done. One method I use is to retrieve saved items from Local St ...

What is causing the malfunction of the position within this particular section?

On my website, I have a specific section where I want to showcase four products with arrows on both sides for navigation. However, I am facing an issue with the positioning of the elements. Can someone take a look and help me figure it out? Check out this ...

Dividing Trapezoid Shapes, Cropping Background Images

I am attempting to design a website layout with trapezoid shapes similar to the attached image. Each section should have a background image that fills the background with cover or a similar effect. I successfully created the first section (dark blue) usin ...

Using AngularJS to handle click events and blur events

I am attempting to dynamically change the class based on user interaction in my code. The class should switch between "large" and "active" depending on whether the input field is filled or not. Please see the modified script below. <div class="snippe ...

Is it possible to create distinct overlapping divs without using absolute positioning?

I'm seeking assistance in developing the view shown below. I am familiar with using position absolute, but I'm wondering if there is a way to achieve this without relying on absolute values. ...

Incorporate a horizontal scrollbar feature within an HTML section

Currently, I am in the process of learning vue js and would like to create a layout that includes two sections. The first section should occupy 3 grids on the screen, be fixed, and not scrollable, with a division into 4 vertical parts. The second section s ...

Can a CSS hover effect transition modify the color scheme?

I have multiple buttons on a single page, and I want the hover effect to be applied to all of them with just one code using jQuery. Please review my code below. $(document).ready(function(){ $('.button').hover(function(){ var bc=$(this ...

Place a material-ui React component at the center of a footer section

I'm facing a challenge with centering a material-ui Simple Breadcrumbs component within a footer as opposed to having it aligned to the left. Even though I'm new to this, I thought it would be straightforward but I can't seem to figure it ou ...

What could be causing the erratic jumping behavior of the "newsletter sign-up" form within my modal dialog window?

On the homepage, there is a modal window that appears upon every pageload (it will be changed later), however, there seems to be an issue with the 'email sign up' form inside the window. The form seems to momentarily display at the top of the si ...

Difficulty linking CSS to HTML in a Flask web application

My HTML/CSS file is pretty straightforward: <!DOCTYPE html> <html> <head> <meta name="viewport" content="width=device-width, initial-scale=1"> <meta charset="utf-8"> <meta name=&quo ...

Is there a way to merge attribute selectors for elements that satisfy one condition or the other?

Is there a way to combine selectors effectively? <input type=number> <input type=date> I was able to successfully hide the arrows in a number field with the following code: input[type=number]::-webkit-inner-spin-button, input[type=number]::- ...

Aligned sections within a Susy layout

Although Susy is a powerful tool, I have noticed a potential weakness with it. For example, imagine having three floated block elements within a container named "blocks": The "block" element is assigned a "span(4 of 12)" <div class="blocks"> &l ...

Cover the entire section with an image

I'm aiming to achieve a similar layout like this (using tailwind) : https://i.stack.imgur.com/G0oti.png Here's the current setup: <section class="bg-juli-white pt-24"> <div class="max-w-6xl mx-auto flex flex-col" ...

Is BEM mandating the creation of superfluous elements?

<header> <a href="#"><img src="kitty.jpg" /></a> ... </header> In the context of organizing for BEM, take this example within the header section that is not dependent on the header block. To adhere to BEM guidelines, I op ...

The multi-line declaration prettier indicates that a newline is expected after the colon

When using Prettier to format code in a scss file, it is formatting this specific part: @font-face { font-family: 'Encode Sans Condensed'; src: url('/pf/resources/fonts/EncodeSansCondensed/EncodeSansCondensed-Thin.ttf') format('tr ...

When hovering over an element, I must utilize a selector and reference a variable that was defined outside of the hover state in order to

Explaining this code may be a challenge, but I'll give it my best shot. Here's the code snippet: $('#navibar a').hover(function(){ var position = $(this).position(); var width = $(this).width(); $('#underliner'). ...

What causes background-color to create gaps of white space?

How can I remove the white spaces on the right and left side of a section when applying a background-color? I want the background-color to fill out the entire width of the section. Should I use extra padding to solve this issue? I have checked the CSS fo ...