Search code examples
cssbackground-image

css can not find background image in my folders


I am allowing users to choose their theme folder /views/theme/images/ theme can be chosen by the user. The css is in the theme folder along with the image folder.

.header {
    float:left;
    height:100px;
    width:100%;
    background-image: (/images/bg-nav.png);
}

and I have tried lots of different image paths in the background image but it's not showing I have tried /views/default/images/bg-nav.png, I've added dots, forward slashes etc.

The image does exist in the following folder: /views/default/images/bg-nav.png can someone help me to display and find my image :/

Here's my html css include

<link href="/views/<?php echo $system->theme(); ?>/style.css" rel="stylesheet" type="text/css" />

It is including fine the stylesheet is working


Solution

  • In your example code above:

    background-image: (/images/bg-nav.png);
    

    Should be:

    background-image: url('/images/bg-nav.png');
    

    You are missing the url. Check the syntax.