Image is appearing when running from live server but not appearing when running html file from my local path

The path, file name and file extensions are correct. Why is the image showing up only when running from live server?

This is the CSS code

#home {  background-image: url("/images/2x/[email protected]");  background-attachment: fixed;  position: relative;  background-size: cover;  background-position: center;  background-repeat: no-repeat;  height: 100vh;  width: 100%; } 
Asked on September 1, 2020 in CSS.
Add Comment
1 Answer(s)

Try to define the whole path from the root like

#home {  background-image: url("C:/Users/yours/web/images/2x/[email protected]"); 

or define the path from the location html file like

#home {  background-image: url("images/2x/[email protected]"); 

if you have to step back use .. as well like

#home {  background-image: url("../images/2x/[email protected]"); 
Answered on September 1, 2020.
Add Comment

Your Answer

By posting your answer, you agree to the privacy policy and terms of service.