Search code examples
htmlcssbackground-image

Background image path is not working even when I use url('../../images/image.png')


I am getting Failed to load resource: the server responded with a status of 404 (Not Found) error when I give the background image path as shown:

body {
    background-image: url('../../images/img.png') !important;
    background-color: #d0dfe5 !important;
    background-repeat: repeat;
    font-size: 14px !important;
}

I don't for what reason I am getting this error. Is there anything I need to change in the path? Please help me.


Solution

  • Based on your directory structure, your image is in a folder one level above current location and not two. Which is why you need to use ../ as suppose to ../../

    Try this: '../images/hrm_taustakuvan_verkko.png'