Images inside of a <div> element are failing to display

I am facing an issue where the image in my <div=img-header> is not showing up beneath the writing. I have tried multiple methods but none of them seem to work. Can someone assist me?

I attempted changing the class to id, manually resizing the image, modifying the CSS code, and altering the name:

.img-header {
height: 100vh;
min-height: 500px;
background-image: url('img/header.jpg');
background-size: cover;
background-position: center;
background-repeat: no-repeat;
}
<header class="img-header">
<div class="container h-100">
<div class="row h-100 align-items-center">
<div class="col-12 text-center">
<h1 class="font-weight-light">My Site</h1>
<p class="lead">Welcome to My site!</p>
</div>
</div>
</div>
</header>

The image inside the div should be displayed underneath the text "My site - Welcome to my site".

Answer №1

Consider using this background-image path: url('/images/main-header.jpg'); rather than background-image: url('images/header.jpg'); It's crucial to always use the correct file path.

Answer №2

Ensure that your .css file is accurately connected. Utilize the browser's developer tools to examine the div and confirm accessibility of the image.

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

The Boostrap card-deck appears to be see-through and malfunctioning

This problem has been puzzling me for quite some time now, and I just can't seem to find the solution! Kindly disregard the other language and code - the card is located under the jumbotron. (To access the link, remove spaces: https://code pen.io/ano ...

modifying the appearance of the play button through a JavaScript event without directly altering it

I am currently working on building a music player from scratch using HTML, CSS, and JavaScript only. To store the list of songs, I have created an array named "songs" with details such as song name, file path, and cover image path. let songs = [ {songNa ...

Issue with jQuery in Internet Explorer causing difficulties loading images

I'm experiencing an issue with my website where all the images load on top of each other when the site is first loaded, creating a chaotic mess. The desired functionality is for the images to remain invisible until specific words are clicked, which is ...

Tips for reaching a node.js application deployed on Heroku

Trying to deploy my node.js app to Heroku has been a challenge. Despite watching various tutorials and reading the documentation, I'm stuck on how to send and receive data from the hosted node.js app. The communication between my webpage and the node. ...

What is the best way to ensure an element reaches its full height limit without triggering the need for page scrolling?

Can you help me with a dialog box issue I am facing? $(document).ready(function() { $('.ui.modal').modal('show'); }); <script src="https://cdnjs.cloudflare.com/ajax/libs/jquery/3.3.1/jquery.min.js"></script> <link hr ...

Converting CSS specific to a particular vendor: A step-by-step

Looking for a method to adapt a CSS file containing only -moz-css-property references to include compatibility with Chrome, Safari, and other browsers. Ideally seeking a user-friendly web application that can perform this task seamlessly. ...

A vertical line in Javascript extending upward from the base of an element

Is there a way to create a design where an infinite vertical line extends from the bottom of a circle (or in my case, a rectangle) without using css :after or pseudo-elements? I would like the line to be its own element and not limited by the restriction ...

Unable to achieve text centering within a button using HTML and CSS

I'm diving into the world of HTML/CSS for the first time and encountering some issues along the way. In my setup.html, I created a "Continue" button and applied a class to style it in styles.css. However, I'm facing an issue where text-align cen ...

How can CSS be used to select and style all elements within a <p> tag?

My fashion sense is specific: #style p { padding:10px; } I'm unsure which elements will be nested inside the paragraph. Is there a method to apply 10px padding to all elements within that paragraph? Can it be done like this? #style p everything ...

Using jQuery to access the ID of a div and create a custom close button

I am trying to implement a close button for my popup DIVs. Each one has a unique ID and I want to hide them by setting the CSS 'display' property to 'none' when closed. However, the following example is not functioning as expected. I a ...

What is the best way to merge different Vue JS instances (each linked to different html divs) into one cohesive unit using Vue

Essentially, I have a scenario where I've created two HTML divs named vueapp1 and vueapp2. Both of these divs serve the same purpose of displaying information and are linked to their individual Vue instances for extracting JSON data and presenting it. ...

selecting unique elements using classes is not possible with jquery

I am experimenting with using ajax on dynamically generated html elements from django. I have tried selecting the instances by class, but for some reason, it is not working as expected. Can anyone point out my mistake here? javascript $(document).ready(fu ...

How a JavaScript Alert is disrupting the design of my ASP.NET Web Application

Despite finding a similar question, the provided answer did not resolve my issue. This is how my application typically appears: However, after triggering a JavaScript alert, the width of menu items becomes distorted and an additional part is added to the ...

Step-by-step guide to creating an Angular HTML template when a button is clicked:

I'm attempting to design an HTML template in order to export it as a PDF File, however, I'm unsure how to accomplish this using Angular's engine; Essentially, what I want to achieve is to construct this template when I click a "Download As ...

How can one choose an HTML element and then select another nested element using XPath?

Is there a way to target the div element "fc-event-time", and then select the next nested div element that is located at the same level? After identifying the text 1p - 2p within this snippet of HTML, how can I access the users' names? Here's t ...

Is there a way to eliminate the gap between my menu choices?

Is there a way to eliminate the black line that appears between my menu options when using CSS hover? https://jsfiddle.net/jameskelly/3ejsu7gx/2/ a:hover { background-color: #ebebeb; font-color: black; } /* Custom styling for the ...

Tips for eliminating the additional space on the right side of MUI grid components

The MUI grid example displayed below appears to leave an additional space on the right side of the grid, giving the impression that it does not fully occupy the available space on the page. https://i.sstatic.net/Q6sgB.png I have attempted to adjust/remov ...

Centered vertically on the right side of a div, a CSS arrow is positioned

Hello, I am seeking a way to vertically center a CSS triangle/arrow on the right side of a div using pure CSS. Unfortunately, I can't include images due to my low reputation. Currently, my code is not functioning properly and lacks cross-browser comp ...

What is causing this absolute list item to stray away from its parent container?

Why is the ul element taking up the full width of the wrapper element when the container div is its parent? How can this be adjusted? Here is the HTML structure: Wrapper | container | label | input | ul | botton Here is the ...

Double-clicking does not allow you to choose individual tags

We are encountering an issue with the double click behavior in the pandas documentation and pydata-sphinx-theme. I believe a HTML expert could shed some light on what's going wrong. Reference: https://github.com/pydata/pydata-sphinx-theme/issues/388 ...