"background-image" code not working

Collapse
X
 
  • Time
  • Show
Clear All
new posts
  • strawberryabs
    New Member
    • Oct 2017
    • 1

    "background-image" code not working

    Here's the code:
    Html:
    <!DOCTYPE html>
    <html lang="en">
    <head>
    <title>title</title>
    <meta charset="utf-8">
    <link rel="stylesheet " type="text/css" href="Style_01. css">
    </head>

    <body>
    <header>
    header
    </header>
    <nav>
    nav
    </nav>
    <main>
    main
    </main>
    <footer>
    footer
    </footer>

    </body>
    </html>
    CSS:
    body{
    background-image: url("Images\bac k_01.jpg");
    }

    All files should be correctly named. I've been at this for hours and I can't figure it out. Help!

    Btw, I know that the CSS does work. If I do "background-color" it works with what I define. But for some reason the code for "background-image" (or shorthand background with image url after) doesn't work.
  • tdrsam
    New Member
    • May 2015
    • 97

    #2
    I'm just guessing at this but I suspect your image (the actual file) can't be found by your code.

    Have you tried using dev tools to see if the url of your image is correct? If not, go to the browser your using to view the webpage your making, and right-click. In Chrome you choose 'Inspect', in Firefox you choose 'Inspect Element'. It's different for all browsers, just google to find out what it is for your browser, if it's not one of those.

    In Firefox, when you hover your mouse over the background-image code, the image displays. If the code isn't correct it will tell you that the image can't be found. If that happens, it means you haven't quite gotten the url code right. The name of the folder has to be correct as well as the name of the file. The folder has to be in the right location as well.

    If that's not even close, just let me know and we could try something else.

    Comment

    Working...