Can someone assist me with troubleshooting why my background-image is not displaying in the browser?

I am having trouble displaying an image in the browser. My HTML code is simple and straightforward, but for some reason, the image is not showing up. I placed the image in a folder named "image" and it worked when I tried the same code in a different folder. However, in this particular folder, nothing is being displayed. What could be the issue?

* {
  box-sizing: border-box;
  margin: 0;
  padding: 0;
  text-decoration: none;
}

body {
  background-image: url("https://via.placeholder.com/150");
  background-position: center;
  background-size: auto;
  background-repeat: no-repeat;
}

.logopic {
  width: 4em;
}

#container {
  display: flex;
  justify-content: space-between;
  align-items: center;
  width: 80%;
  margin: 15px auto;
}

.list-item-ul {
  list-style: none;
  margin: 0em 2em 0em 0em;
}

.list-item-li {
  text-decoration: none;
  display: inline-block;
  background: rgb(186, 178, 117);
  padding: 0.20em 0.50em 0.20em 0.50em;
  margin: 0em 1em 0em 1em;
}

li a {
  color: white;
}
<!DOCTYPE html>
<html>

<head>
  <title>
    Responsive Web Three
  </title>
  <link rel="icon" type="image/png" href="image/logo.png">
  <link rel="stylesheet" type="text/css" href="css/style.css">
</head>

<body>
  <header id = "container" id="topheader">
    <img src="https://via.placeholder.com/150" alt="logo" class="logopic">
    <nav class="list-item-nav">
      <ul class="list-item-ul">
        <li class="list-item-li"><a href="">home</a></li>
        <li class="list-item-li"><a href="">About us</a></li>
        <li class="list-item-li"><a href="">Services</a></li>
        <li class="list-item-li"><a href="">Portofolio</a></li>
      </ul>
    </nav>
  </header>

</body>

</html>

Answer №1

Consider updating the following code snippet:

<link rel="icon" type="image/png" href="image/logo.png">

to reflect this change:

<link rel="icon" type="image/png" href="logo.png">

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

Preventing Page Refresh when Button is Clicked in Angular

How can I prevent page reload when a button is clicked in Angular? I'm developing a quiz application in Angular where I fetch random questions and options from an API. When users select an option, the next question should appear without reloading the ...

Trouble viewing Three.js content in Index.html

My current project involves building a website using three.js with typescript. However, I am facing an issue where only the header from my index.html file is displayed when I try to load the website onto a local server. The main problem arises when I atte ...

The functionality of the click event on div elements seems to be inconsistent and not working as expected on some divs

I've been trying to create dynamically generated divs called "megaPixel" that respond to clicks, but for some reason, they are not working properly. I wrote a function to select all divs, but only the other divs respond when clicked. function createM ...

Performing addition and subtraction calculations with HTML and Javascript

I need help creating a simple HTML table for adding and subtracting values, with a limit of 10 and a minimum of 0. I have two functions set up, additionalAdd and additionalSub, triggered by the onclick event, but I keep getting an error saying that totalAd ...

Ways to display the <tbody> section in a grid layout

How can I display elements in a grid view (horizontally, 3-4 elements per row) with adequate spacing between them? I attempted to use margin but it was ineffective. This is my HTML.erb code: <h1> Entries </h1> <table> <% @listings.e ...

Modifying the array structure will deselect all individual <Input> elements that have been iterated

Hoping to create a system for adding/removing sub-items with buttons that increment/decrement slots in an array, where input fields are automatically added and removed: <div *ngFor="let item of itemsInNewOrder; let i = index"> <input [(ngModel) ...

When hovering over a hyperlink, an image appears but I want to adjust the image's position in relation to each link

I have a unique feature on my website where text hyperlinks reveal small thumbnail images when hovered over. This concept was inspired by an example I found on this page. I initially implemented the code from a post on Stack Overflow titled Display Image O ...

What is the best way to slim down a material ui icon?

I need help creating a slimmer Material UI icon with a +: This is what it currently looks like: https://i.sstatic.net/VXsCW.png This is the desired outcome: https://i.sstatic.net/kkkll.png <AddCircleIcon style={{ color: "#00B790", fontSi ...

Make the background disappear when the text field is left empty and the cursor is not present (onUnfocus)

When the text field is empty and there is no cursor in the text field, I want it to be transparent and for the spell checker not working. The result should be displayed a little to the left inside a <div>. Should this be done using CSS, JavaScript, ...

Ensure that scripts with the type of "module" are completed before proceeding to execute the following script

In my HTML document, I have two script tags with type="module" at the bottom of the body tag. Following those, there is another script tag with embedded code that relies on the results of the first two scripts. Is there a method to ensure that this code ...

Transition within Bootstrap navbar is not as smooth as desired

My bootstrap navbar HTML code is as follows: <nav class="navbar navbar-expand-lg navbar-dark" style="background-color: rgb(50, 50, 50)"> <button class="navbar-toggler" type="button" data-toggle="col ...

JavaScript causing values to disappear when the page refreshes

When a user hovers over ImageButtons, I use Javascript to change the ImageUrl. However, on submitting the form, the updated ImageUrl property is not reflected in the code behind. Similarly, I also dynamically update a span tag using Javascript, but its alt ...

Understanding how to sum the values of two separate dropdown selections using jQuery

Is it possible to combine and total up two different selections to display on the "Total" button below? I have added calculations to each selection. When a user selects a quantity, it should automatically sum up and display on the "Total" button, but I am ...

Have I incorrectly implemented responsiveness on my website?

I created my HTML using Bootstrap 3.3.7: <html> <head> <meta charset="UTF-8"> <meta name="viewport" content="width=device-width, initial-scale=1.0"> <meta name="copyright" content= ...

Is there a way to make my extended list bump up the rest of the elements on the page

I've created a section designed to function as a product filter in the future. Currently, when the parent option is clicked, the list expands to show the sub-options. However, I'm facing an issue where I need the parent option and styled span to ...

Learn the trick to making specific words appear bold in Select2 by changing the font style

I'm currently working with select2 version 4.0.1, and I have a requirement to modify the font for specific words. In particular, I want to display codes AK and HI in a different/bolder font style, similar to the example below: <select id="select2" ...

A step-by-step guide for embedding an image on an HTML webpage with Flask

In the process of developing a web application, I aim to embed a compact image within an HTML table and enable its movement across different table cells. The technologies involved in my project include Python, JavaScript, HTML, and CSS. The concept is ill ...

Learn how to easily incorporate a drop-down list into the material-UI Search component within the navbar to enhance the search results

I integrated a Material UI search bar into my React app's navbar following the instructions from the official documentation on MUI. However, the article does not provide any guidance on how to add a dropdown list when selecting the search input field. ...

Difficulty encountered when applying a CSS class with JavaScript

The Javascript function I am currently using is able to select multiple links. This behavior occurs because of the Regular expression I applied with the '^' symbol. I decided to use this approach because my links are in the following format: htt ...

What steps can be taken to ensure that the scale() function is given the highest priority

Trying to develop a program that generates a canvas graph based on some calculated data. To adjust for larger numbers, I attempted to scale the graph using ctx.scale();. However, every time I do this, the canvas goes blank! I even tried scaling the canvas ...