Challenges with Implementing Background Images on my Website with HTML and CSS

Being new to the world of coding, I recently created a website for a college presentation. However, after uploading the website onto the internet, I noticed that the background images from my files are not displaying on the website. It's likely that I made a rookie mistake somewhere along the way, and any feedback or suggestions would be greatly appreciated as I navigate through this confusion outside my comfort zone. Thank you, Sam.

Here is how my home page should look And here is how my home page currently looks like.

.index-banner {
    
  width: 100%;
  height: 100vh;

  background-repeat: no-repeat;
  background-position: center;
  background-size: cover;
  display: table;
}
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="utf-8>
<meta name="viewpoint" content="width=device-width, initial-scale=1.0">
<title&rt;The Cloververse: A Transmedia Project</title>
</head>
<body>
<!--This is the main content-->
  <link rel="stylesheet" href="style.css">
    

<header>
 <a href="index.html" class="header-brand">Cloverfield: A Transmedia Project</a>
 <nav>
 <ul> 
<li><a href="index.html">Home</a></li>
<li><a href="About%20the%20Project.html">Project</a></li>
<li><a href="videos.html">Videos</a></li>
<li><a href="Resources.html">Resources</a></li>
</ul>
</nav>
</header>    
<main>
<section class="index-banner">
<div class="vertical-centre">
<div class="Index-html">
<h2>Cloverfield:<br>A transmedia Project</h2>  
<h1>This website is related to the Cloververse. The cinematic universe regarding the Cloverfield film franchise. This website is part of a project on Transmedia. This serves as a platform for all things related to the Cloverfield film franchise and its surrounding ARG. The website will have videos from and about the ARG, links to resourceful websites and a smaller more in-depth piece on why I have made this website.</h1>  


<iframe src="https://giphy.com/embed/bkbh97abxVMKQ" width="1000" height="400" style="0" class="giphy-embed" allowFullScreen></iframe>
</div>
</div>
</section>  
    
</main>
</body>
</html>

Answer №1

My solution seemed to work for me (based on my understanding of what you're trying to achieve). I made sure to specify the background image for the index-banner css class:

.index-banner { 
    width: 100%;
    height: 100vh;

    background-repeat: no-repeat;
    background-position: center;
    background-size: cover;
    display: table;
    background-image: url("https://wallpapercave.com/wp/wp3816463.jpg");
  }

Everything functioned as expected after implementing this code. Just remember to update the URL in the image link to match the location of your missing image. Keep in mind that this solution won't place the background image behind your header or navigation section. If you want to include the header, you'll need to adjust the rules above and apply them to the body tag of the page instead.

I hope I've correctly understood your needs!

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

Selenium tactics: patiently awaiting the arrival of a specific element

I am fairly new to Selenium, so please bear with me as I ask some potentially simple questions. Lately, I've been exploring ways to make Selenium wait until a specific element is fully loaded within a pop-up <div>. My goal is to scroll down to c ...

Is there a way to achieve a straightforward three-column stacked layout in Bootstrap 5 that spans 100% of the viewport height?

Today I decided to try out Bootstrap 5 for the first time. However, I am facing a challenge in creating a 3 stacked column layout with box-1, box-2, and box-3 on top of each other, taking up 100vh. I have shared a redacted version of the code below, wher ...

Aligning text fields and text areas is not consistent

Seeking a solution to align two input fields side by side, with a textarea directly below them form ul { list-style: none; text-align: center; } form ul li { display: inline-block; margin-left: auto; margin-right: auto; } #nameform, #emailform ...

Creating a smooth image transition effect using CSS

I have successfully implemented a code that allows for crossfading between images when the mouse hovers over them. Now, I am looking to modify the behavior so that the crossfade effect happens only once when the mouse passes over the image. In other words ...

What is the best way to shorten text in React/CSS or Material UI based on the line height multiples?

I'm facing an issue with creating a Material UI card that contains text. My goal is to set a fixed height for the card and truncate the text if it exceeds 3 lines. Can anyone suggest the best approach to achieve this? Here's the code snippet I&a ...

When attempting to render HTML containing multiple CSS classes within a JSON request parameter, the styles are not being applied as expected

In my API, I'm dealing with a JSON request parameter that includes an HTML string. This HTML string references CSS styles from a separate .css file. However, when an HTML element has two CSS classes assigned to it, neither of the classes' styles ...

Restrict the Number of Columns in GridView

I am currently working with a gridview that displays product information. I'm trying to find a way to limit the description field so that only the first few lines are shown if it is too long, and also resize the image to fit into the image column whil ...

Any suggestions on how to repair this Node.js login interface?

Currently grappling with setting up a Node.js application with a MySQL database to create a basic login functionality. Encountering an issue: Cannot POST /login <body class="hero-image"> <div id="container"> <div ...

Tips for effectively handling repetitive bootstrap CSS code

As part of my coding routine, I often utilize the following code snippet to center specific content: <!-- horizontal --> <div class="d-flex align-items-center justify-content-center h-100"> .. </div> <!-- vertical --> & ...

Troubleshooting: CSS border-radius issue with embedded iframe

I am struggling to embed an iframe from my Blogger site into a specific section on my website and round its corners using CSS. I followed a tutorial that suggested using overflow: hidden;, but for some reason, it's not working in my case - see the ima ...

use python selenium to retrieve text enclosed by two span elements

<li class="page-item active"> <span class="page-link"> "12" <span class="hjhs">(current)</span> </span> </li> After reviewing the code above, my objective is to extr ...

What is the best way to change the class of an input using jQuery when it is not empty?

Utilizing Bootstrap 4. I am working on a feature where I have four text inputs. If any of these inputs contain values, I want to add a specific class to a button. Upon clicking the button, my goal is to clear all input values and remove the aforementione ...

Ways to stop the floating label from blending with the input field

Attempting to incorporate the Bootstrap Material design theme into my project, I have implemented a basic text input field using the code below: <div class="form-control-wrapper"> <input class="form-control empty" type="text"></input> ...

Place an element in relation to the vertical size of a div that includes written content

Currently, I am working on implementing a button with a popup that appears underneath it when the user hovers over it. The specific requirements for this setup are: The size of the button should not affect the size of the popup The popup should always be ...

Syntax error: Your code encountered an unexpected closing curly brace

Here is the code snippet I am working with: <?php session_start();?> <!DOCTYPE html> <html> <head> <title>Narcis Bet</title> <meta charset="utf-8"> <link rel="stylesheet" href="css/style.css" type="text/css"&g ...

How can I invoke a PHP script using AJAX?

I am currently working on implementing a feature that involves multiple tables where users can move table rows between the tables. I want to use ajax to call a php script that will update the database with the new values, specifically assigning a new paren ...

What is the best way to use Jquery to enclose a portion of a paragraph text within a

How can I wrap the content inside a span that comes after another span, inside a paragraph and a new span? To further illustrate this, consider the following example: <p>foo <span>bar</span> baz</p> The desired outcome is: <p& ...

Align Text with Icon Using FontAwesome

Hey, I'm having a bit of trouble with something simple and it's driving me crazy. All I want to do is center the text vertically next to a FontAwesome icon. However, no matter what I try, I just can't seem to get it to work. I've looke ...

Utilizing divisions for specifying CSS attributes

I'm attempting to distinguish the CSS properties of two tables based on which DIV they are contained within. If you take a look at http://jsfiddle.net/jdb1991/tpXKT/, you will notice that the table in "resultA" is utilizing the TD property designated ...

Incapable of modifying the text within a div container

I am currently working on a script that translates a Russian forum word by word using TreeWalker. However, there is a specific type of div element that I have been unable to change the text for. That leads to my question: How can I go about changing it? Un ...