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

How can I code a div to automatically scroll to the top of the page?

I'm attempting to implement something similar in WordPress - I want a div containing an advertisement to initially start 300px down the page, then scroll up with the page until it reaches the top, and finally stay there if the user continues to scroll ...

Interact with webpage dropdown menus using Python

I'm currently working on a Python script that interacts with a webpage, specifically , to retrieve a (DNA sequence in fasta format) file. The file is automatically downloaded when a user clicks on a dropdown menu. Here's the dropdown menu: Dow ...

The concept of the "Centering Effect" refers

Check out the code I have below: http://jsfiddle.net/G8Ste/577/ I want the effect to expand in all directions, not just to the right and bottom. I've experimented with margin: 0, auto, and other CSS and HTML styles to center it, but nothing seems t ...

Teaching etiquette to the students of Li

I'm having trouble getting two lists to display correctly on my website. I want one main navigation list that is horizontal and another sub navigation list that is vertical. To achieve this, I need to have two different classes for the list items in m ...

Is it possible to create a button that can bring in a .css file?

Is there a way to create a button that imports styles from a .css file, or is it possible to change multiple CSS properties with buttons to create different website themes? This is the CSS file I have: .body { background-image: url("example.png"); } ...

Is it possible to display a div when hovering over it and have it remain visible until

How can I make the div ".socialIconsShow" fade in when hovering over ".socialIcons", and then fade out when hovering over ".socialIconsShow"? Is there a way to keep the icons visible even after leaving ".socialIcons"? <div class="socialNetworks"> ...

"Ensure that the data in the div is being updated accurately via AJAX in ASP.NET MVC

I'm currently using a div element to display data on page load through AJAX calls. $(document).ready(function () { email_update(); }); function email_update() { $.ajax({ url: '@Url.Action("EmailsList", "Questions")', ...

Tips for implementing an autoscroll feature in the comments section when there is an abundance of comments

Having a large number of comments on a single post can make my page heavy and long sometimes. This is the current layout of my post comment system: Post 1 Comment for post 1 //if comments are more than 3 <button class="view_comments" data-id="1">Vi ...

Unlock the power of Component level CSS in NextJS with this simple guide!

I don't have much experience with CSS, as I rarely write it these days due to the popularity of libraries like MUI. However, I recently found myself in a tricky situation where I needed to rewrite this example Emabla carousel in typescript and NextJS. ...

What could be causing my function to execute thrice?

I cannot seem to figure out why my tag cloud is causing the required function to run multiple times instead of just once when I click on a tag. This issue persists whether using jQuery or plain JavaScript. What am I missing? The code I have is very simple, ...

What is the best way to apply a :visited selector specifically to the most recently visited webpage?

I've noticed that all the pages I've visited on the site have now changed to the color I chose. However, my goal is for only the last page I viewed to be in the color I assigned. Thank you! ...

To replace basic SVG icons upon clicking with the use of HTML, CSS, and jQuery - here's how!

I have a simple question about inline SVG icons and how to handle them in HTML, CSS, and jQuery. Despite reading numerous resources, I still struggle with implementing the functionality where clicking on one icon changes it to another. My objective: To to ...

Select the dropdown menu to access the last line of the table

My custom dropdown is causing a scroll to appear at the bottom of the table when it's open, making it hard to view all the elements. I want to find a way to either expand the body of the dropdown or enlarge it so that this doesn't happen. Can any ...

Adjusting the height of a vertical slider in Vuetify2 is not customizable

I've been trying to adjust the height of a vertical slider in vuetify2, but setting it to "800px" or using style="height:800px" doesn't seem to work as intended. Even though the box within my grid expands, the height of the slider remains unchan ...

Enhancing a Bootstrap 4 navbar menu system with padding tweaks

Just starting out with Bootstrap 4 and creating a practice page with a header to familiarize myself with the navbar system. I have put together this jsFiddle (full code) for reference, but essentially, my page structure is as follows: index.html <nav ...

Utilize JavaScript to append a CSS class to a dynamic unordered list item anchor element

I am working with a list of ul li in a div where I need to dynamically add CSS classes based on the click event of an anchor tag. Below is the HTML structure of the ul li elements: <div class="tabs1"> <ul> <li class="active"> ...

How to Animate the Deletion of an Angular Component in Motion?

This stackblitz demonstration showcases an animation where clicking on Create success causes the components view to smoothly transition from opacity 0 to opacity 1 over a duration of 5 seconds. If we clear the container using this.container.clear(), the r ...

Is your Facebook send button appearing strangely? Find out how to fix it here!

I recently integrated the Facebook send button on my website, allowing users to easily share information about each drive listed. However, a new issue has arisen where clicking on the send button opens a popup inside a table, negatively affecting the page& ...

Assist me in temporarily altering the color of menu items in a sequential manner upon the page's loading

Currently, I'm working on a website that features a subtle dark grey menu at the top of every page. The menu is built using HTML and CSS with a list structure. To highlight the corresponding menu item based on the current page, I am utilizing the ID a ...

Effortless Page Navigation - Initial click may lead to incorrect scrolling position, but the subsequent link functions perfectly

While implementing the Smooth Page Scroll code from CSS Tricks, we encountered an issue where clicking on a navigation link for the first time only scrolls down to a point that is approximately 700px above the intended section. Subsequent clicks work perfe ...