pages with parallax scrolling arranged in a unique and unconventional manner

Below the fullscreen home card, I want the about div to appear

I am struggling to get it to display correctly.

In my HTML code, both divs are in the correct order, but I couldn't find any solutions online.

<body>
    <div class="homeCard">
        <div class="homeCardTitle">
            <h1>Robin Riezebos</h1>
        </div>
    </div>
    <div class="aboutCard">
        <div class="aboutCardText">
            <h2>About</h2>
        </div>
    </div>
</body>

Either my CSS is missing something or I made a mistake, and I can't figure out what it is. Please help...

index.css

.homeCard {
    background-image: url("images/helicopter-in-sky-2.jpg");
    height: 100%;
    width: 100%;
    position: fixed;
    float: left;
    background-position: center;
    background-size: cover;
    background-repeat: no-repeat;
    z-index: 0;
}

.homeCardTitle {
    position: fixed;
    width: 100%;
    height: 320px;
    top: 50%;
    margin-top: -160px;
    color: white;
    text-shadow: 0 0 10px black;
}
.aboutCard {
    background-color: #1F1F1F;
    color: white;
    height: 500px;
}

Answer №1

To resolve the issue, adjust your CSS as follows. The problem may be related to the fixed position setting; to ensure your background image displays correctly, specify the height in pixels accordingly.

.homeCard {
            background-image: url("images/helicopter-in-sky-2.jpg");
            width: 100%;
            position: relative;
            background-position: center;
            background-size: cover;
            background-repeat: no-repeat;
            z-index: 0;
        }

        .homeCardTitle {
            color: white;
            text-shadow: 0 0 10px black;
        }

        .aboutCard {
            background-color: #1F1F1F;
            color: white;
            height: 500px;
        }     

Answer №2

After some exploration in my CSS, I managed to find a solution to my issue. It turns out that instead of using position: fixed;, I should have utilized background-attachment: fixed; and completely removed the position property.

Here is the updated code:

.homeCard {
    background-image: url("images/helicopter-in-sky-2.jpg");
    height: 100%;
    width: 100%;
    background-attachment: fixed;
    float: left;
    background-position: center;
    background-size: cover;
    background-repeat: no-repeat;
    z-index: 0;
}

.homeCardTitle {
    position: relative;
    width: 100%;
    height: 0px;
    top: 50%;
    margin-top: -90px;
    color: white;
    text-shadow: 0 0 10px black;
}
.aboutCard {
    width: 100%;
    background-color: #1F1F1F;
    color: white;
    height: 320px;
    float: left;
    text-align: center;
}

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

Generate visual content from written text with the use of a form and store it on the

Struggling to implement a php function on my webpage that generates an image from text input. However, nothing appears to be happening when I execute the code: PHP - $to = $paths. '/card.png'; if (isset($_POST['make_pic'])) { $text = ...

PHP is functioning properly, but no content is being displayed

I recently delved into coding and had to tackle a form that sends data through email using PHP. While the functionality of my form is working perfectly and I'm able to receive emails, I encountered an issue where the PHP page appears blank. Despite tr ...

Issue with Electron Remote process failing to take user-defined width and height inputs

I'm currently facing an issue with utilizing remote windows in electron. I am attempting to process user input and use that input to generate a new window with specific width and height. However, when I hit submit, nothing happens. I can't figur ...

Why are the random colors blending into the image?

After watching a tutorial on the YouTube channel Online Tutorials titled "Change Image Color Vanilla JavaScript," I am confused as to why some random colors from the click event are overlapping the image instead of just changing the color of the cat's ...

Ways to display content exclusively to logged-in users

Currently, I am working on a website and facing a challenge in displaying certain elements on the navbar only if the user is logged in. The structure of my project involves using inheritance, which means that the navbar is included in my layout.html file. ...

Secure Your PHP Accounts

My current website hides the account window where users can change passwords, upload files and more using a simple code snippet: <?php if($is_logged_in) { ?> <div id="account_window"> //content </div> <?php } ?&g ...

Ways to emphasize the index navigation link when on the main page

Currently, there is a web design project that I am tackling and have encountered a slight hiccup that needs resolving. The issue revolves around highlighting different navigation links based on the URL of the current page. This functionality works seamless ...

What are some solutions for resolving differences in the display of pseudo elements between Macbooks and Windows desktops?

Greetings! I successfully converted an XD file to HTML and CSS code. I tested it on my Windows PC, but I haven't had the chance to test it on a Macbook yet. Details: I implemented a button with a pseudo element to show a right arrow on the right side ...

"One specific div in Safari is having trouble with the external stylesheet, while the other divs are functioning properly- any

I'm facing a puzzling issue that has me stumped. I'm working on a website and have a simple footer with a link at the bottom: <div id="sitefooter"> <a href="#">This is the link</a> </div> My stylesheet includes styling f ...

The issue of why padding left is not functioning correctly in Bootstrap version 5.3.1

</head> <body> <header class="bg-info "> <div class="container"> <div class="row text-white"> <div class="col-md-6 p-3 pl-6 "> ...

Safari Mobile not rendering absolute positioning correctly

Our website www.anahatainternational.org has a functioning search section that is displaying correctly on Firefox, Chrome, and Safari browsers. However, we have encountered an issue with the mobile version of Safari where the search section appears in the ...

I would like the background image to perfectly fit the dimensions of the parent container

https://i.sstatic.net/PlCYU.png Is there a way to prevent the background image from overflowing and causing a horizontal scroll bar to appear? The layout of the page consists of two columns, with each column taking up 50% of the width. The left column con ...

Set up a custom JavaScript function to automatically refresh a webpage

I am in the process of setting up a JavaScript function to refresh on a specific webpage. The website utilizes an overarching JS and CSS framework, but I desire this particular function to load in a unique manner. The JS function within the framework dyna ...

Looking for assistance with deleting a child element in an XML file using PHP

I need help figuring out how to delete a child from my jobs.xml file with a PHP script. My jobs.xml file looks like this: <jobs> <event jobid="1"> <title>jobtitle</title> <desc>description</desc> &l ...

"Utilize Python's Selenium library to automate clicking the 'Get Data

Having trouble with clicking the GetData button to retrieve the output. Looking for assistance on how to achieve this. Update your code below:- from selenium import webdriver from selenium.webdriver.common.keys import Keys from selenium.webdriver.chrome.o ...

What is the best way to create a floating navigation bar that appears when I tap on an icon?

As a beginner in the realm of React, I recently explored a tutorial on creating a navigation bar. Following the guidance, I successfully implemented a sidebar-style navbar that appears when the menu icon is clicked for smaller screen sizes. To hide it, I u ...

Ensuring a dependable detection of WebSocket connection status

I've been researching how to create a dependable method for recovering a WebSocket connection. After exploring various options, I discovered that one approach involves sending heartbeats (ping/pong) to the server and monitoring if the entire pong is ...

Using CSS styles in emails can lead to an unexpected horizontal scrolling effect

I am currently working on an application using Symfony, and I have implemented a basic confirmation email with minimal CSS styling. However, the email template is causing horizontal scrolling due to the layout. Below is the HTML code of my email template: ...

Acquiring the underlying code of websites within the local network

In the tool I am creating, it takes a URL as a parameter and retrieves the source code from that URL for analysis. The tool will be hosted on our domain, with the capability of analyzing web pages of sites within our internal network domain. Here is the Jq ...

Crash in the Android WebView of the Galaxy S3 device due to Signal 11 SIGSEGV

My Android WebView is experiencing issues with memory access and crashes on a Galaxy S3 running Android 4.0.4. The HTML5 content includes interactive battles where enemies appear for the user to slash, interspersed with normal HTML pages. Despite the use o ...