Image not showing up on HTML page following navigation integration

Having trouble with my responsive website setup - the background image for ".hero-image" isn't showing up after adding the navigation. Google Chrome console is throwing a "Failed to load resource: the server responded with a status of 404 (Not Found)" error.

The image file is located at "img/Header.jpg"

I've checked and double-checked my new navigation bar code, but can't find any conflicts. Already verified the file location

CSS



.hero-image{
    background-image: linear-gradient(rgba(0,0,0,0.5), rgba(0,0,0,0.5)), url("img/Header.jpg");
    height: 100%;
    background-position: center;
    background-repeat: no-repeat;
    background-size: cover;
    position: relative;
}

.hero-text{
    text-align: left;
    position: absolute;
    margin-left: 20%;
    color: white;
    font-family: 'Roboto Mono', monospace;
}

*{
    margin: 0px;
    padding: 0px;
    box-sizing: border-box;
}

nav{
    display: flex;
    justify-content: space-around;
    align-items: center;
    min-height: 8vh;
    background-color: #343434;
    font-family: 'Roboto Mono', monospace;
}

#logo{
height: 100px;
}

.nav-links{
    display: flex;
    justify-content: space-around;
    width: 30%;
}
.nav-links li{
    list-style: none;
}
.nav-links a{
    color: white;
    text-decoration: none;
    letter-spacing: 3px;
    font-weight: bold;
}

.burger{
    display: none;
    cursor: pointer;
}

.burger div{
    width: 25px;
    height: 3px;
    background-color: white;
    margin: 5px;
    transition: all 0.3s ease;
}


@media screen and (max-width: 1024px){
    .nav-links{
        width: 60%;
    }
}

@media screen and (max-width: 768px){
    body{
        overflow-x: hidden; 
    }
    .nav-links{
        position: absolute;
        right: 0px;
        height: 100vh;
        top: 0vh;
        background-color: #3f3f3f;
        display: flex;
        flex-direction: column;
        align-items: center;
        width: 80%;
        height: 100%;
        transform: translateX(100%);
        transition: transform 0.5s ease-in;
    }
    .nav-links li{
        opacity: 0;
    }
    .burger{
        display: block;
    }
}

.nav-active{
    transform: translateX(0%);
}

@keyframes navLinkFade{
    from{
        opacity: 0;
        transform: translateX(50px);
    }
    to{
        opacity: 1;
        transform: translateX(0px);
    }
}

.toggle .line1{
    transform: rotate(-45deg) translate(-5px,6px);
}
.toggle .line2{
    opacity: 0;
}
.toggle .line3{
    transform: rotate(+45deg) translate(-5px,-6px);
}

HTML

        <div class="hero-text">
        <h1>Ruan Kuypers</h1>
        <h2>Websites. Done. Right.</h2>
        <h3>A relighable business partner.</h3>
        </div>
    </div>

Error message: Failed to load resource. The server reported a status of 404 (Not Found)

Answer №1

The location of your HTML file within the folder structure will determine how to correctly reference images in your code.

For example, if your HTML file is located in the root folder, you can use: "./img/Header.jpg". If it's outside a folder, try using: "../img/Header.jpg".

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

Random image generator using jQuery on the home page body

Hey guys, I'm working on a cool feature for my Wordpress site where a random background image loads every time the homepage is refreshed. Check out the code snippets below: First, here's what I have in my style sheet (style.css): body.home { ...

Using :nth-child on elements with the same class name does not produce the desired result

I attempted to utilize the :nth-child selector to target the first, third, and fifth elements with the class name "personal", but it did not work as expected. Is there an alternative method to specifically select these elements sharing the same class? I ha ...

Ways to center text within a nested div in a parent div with table-cell styling

The issue I am facing involves a parent div with the CSS property display: table;. Nested inside is a child div with display: table-cell;. Despite applying text-align: center;, the text within the second div does not align to the center as expected. Here ...

Guide on obtaining an access token for an API through the use of the POST method in JavaScript

I am trying to obtain credentials for an API that uses OAuth2. The API documentation outlines the process as follows: Request access token: POST: auth/access_token Url Parms: grant_type : "client_credentials" client_id : Client id clien ...

Passing and removing array parameters in HTTP requests using Angular

I have an Array of statuses objects. Each status has a name and a boolean set to false by default. These represent checkboxes in a form with filters - when a checkbox is checked, the boolean value is set to true: const filters.statuses = [ { name ...

The X path and CSS selector for a particular table will vary on every page

Hello, I am new to HTML and currently working on a project that involves scraping data from html tables using RSelenium. I have managed to use the following code successfully: for(i in 1:50){ remDR$navigate(URLs[i]) CPSHList[[i]] <- remDR$getPageSou ...

Building a table in Quasar by utilizing nested objects

I am currently facing an issue while using Quasar to create Q-Tables. I am struggling with incorporating nested objects with dynamic key names. Below is the content of my table: data: [ { 'FrozenYogurt' : { &a ...

The primary view seamlessly integrates with the page following the invocation of the partial view

Whenever the button is clicked, a different partial view is returned based on the selected value from the drop-down list. Controller: [HttpPost] public ActionResult Foo(SomeViewModel VM) { var model = VM; if (Request.IsAjaxRequest()) { ...

Avoiding layout shift when a button is clicked in React JS

I am working on a Drawer example and following the instructions provided at https://mui.com/material-ui/react-drawer/ Everything is functioning as expected, but I am encountering an issue where my content shifts to the right when the drawer opens, and ret ...

After attempting to follow a guide, I encountered a scenario where a view was returning None because the is_ajax function was not

After diving into the world of ajax, I encountered a puzzling issue that I can't seem to crack. My hunch is that it involves the comment_id versus the blog_id. (I was following this tutorial: https://www.youtube.com/watch?v=VoWw1Y5qqt8&list=PLKILt ...

The function WebGLRenderer() from three.js allows for rendering in

When initializing the WebGLRenderer, I am passing in a canvas DOM element like shown below: var jqc = $('#myCanvas'); //accessing canvas with jQuery; var par = {canvas:jqc.get()}; //creating parameter object with canvas DOM element var renderer ...

Passing a variable by copy in a done call with Ajax

Here's the code snippet I'm working with: for (var i = 0; i < list.length; i++) { $.when( $.ajax({url: "./dorequest.php?id=" + list[i], success: function(response){ jsonFriendlist = response; }}) ).done( ...

Is it possible to spread an empty array in JavaScript?

Whenever I run the code below, I encounter the error message Uncaught SyntaxError: expected expression, got '...': [1,2,3, (true ? 4 : ...[])] I'm wondering if spreading an empty array in that manner is allowed? ...

Labels are overlapping each other and being aligned to the right side

Working with the most up-to-date version of Bootstrap, I am currently designing a search bar featuring a dropdown menu preceding the search button. Upon clicking the dropdown, various controls are revealed. Below is the HTML code for this configuration: ...

To ensure responsiveness in JavaScript, adjust the width to 100%

Recently, I came across this piece of code: <div style="text-align:center; max-width:500px; width:100%; margin:auto"> <script type="text/javascript" src="transition_example.js"></script></div> Here is the content of transition ...

Encountered a parsing error while attempting to include the navigation bar page

<?php echo <<< END <!DOCTYPE html> <!-- --> <html> <head> <title>Nav</title> <meta charset="UTF-8"> <meta name="viewport" content="width=device-width, initial-scale=1.0 ...

Unable to locate or modify an item within an array

I have a unique way of organizing my collection, with an array inside. Here's how it looks: const postsSchema = mongoose.Schema({ posts: {type: Array}, }) Now, I want to search for a specific document within this collection. I attempted the follo ...

Employing asynchronous operations and the power of async/await for achieving seamless integration

I am currently facing an issue where I need to retrieve queries from a database stored in Postgres. A function is utilized, which employs a callback mechanism. In order to fetch rows from the database, there exists a function called getRecipesByCategoryFo ...

Steps for eliminating QRcode warning in npmjs package

Issue: Warning Message (node:24688) ExperimentalWarning: buffer.Blob is an experimental feature. This feature could change at any time (Use `node --trace-warnings ...` to show where the warning was created) Seeking Solution: How can I prevent this warning ...

"The boundary of suspense was updated before completing hydration." This error occurs when utilizing suspense and dynamic import within Next.js

I am currently working on lazy loading a list of data using suspense and dynamic import in Nextjs. However, I encountered the following error: Error: This Suspense boundary received an update before it finished hydrating. This caused the boundary to switch ...