Search code examples
htmlcssbackgroundbackground-image

Background Image not working on site, returns error


Background image seems to not work as expected.

The output: See here

Github repo for looking into: https://www.github.com/vishalscodes/shashiks (Files are deployed from the _site folder)

Website: https://shashiks.netlify.app

This doesn't seem to work even with the url() function and it doesn't return any error in the console, which is what I generally use to solve these problems.

PS - Please don't mind my Question framing (Stack Overflow returns too many errors for the code).


Solution

  • Try renaming your CSS variable to the following. Use url() instead of image()

    --youtube-bg-image: url(/img/youtube-logo.jpg);
    

    Also, you had a typo in your image extension. You used .jpeg instead of .jpg