CSS background-image

I’m developing a site with cakephp that use a template from https://github.com/maiconpinto/cakephp-adminlte-theme

I have a problem when I try to set a background image from the body HTML tag

I’ve saved my picture to vendor\maiconpinto\cakephp-adminlte-theme\webroot\img
the image name file is background.png

and this is my code
print.ctp

<_style type="text/css">
    body{
        background-image: url('background.png')?>');
    }

<?php
     $this->layout = 'AdminLTE.print';
?>

<_h1>Hello World</_h1>


but the background image is failed to load

You Need to put the image default directory webroot/img then you can use the that image.
otherwise check the image url on address bar.

1 Like

it doesn’t work, the image background still not load, did my CSS code correct?

url('background.png')?>' seems like a bad value for background-image. Shouldn’t it just be url('background.png') ?

1 Like