开发者

CakePHP, not showing my background-image from CSS file

开发者 https://www.devze.com 2023-01-08 14:51 出处:网络
Cakephp is giving me some problems as I have set as below (I have tried any number of urls, through localhost, placing it in webroot and giving reference from that file, giving full route from localho

Cakephp is giving me some problems as I have set as below (I have tried any number of urls, through localhost, placing it in webroot and giving reference from that file, giving full route from localhost (this is a local test ubuntu machine, not a 3rd party server), etc, etc but it just doesn't show up.. I am using a custom layout that overrides the default layout and, as far as I can tell, it contains no reference to any sort of background image.. here is from my css file:

body {
    background-image: url('http://localhost/site1/app/webroot/img/bg1.jpg');
    font-family:'lucida grande',verdana,helvetica,arial,sans-serif;
    font-size:90%;

}

I have tested that this works f开发者_如何学Cine with a regular HTML file, I am hoping someone has an idea of what cake is up to that is giving me this problem.. thanks

EDIT: I have tested and I can display exactly the same image within a DIV (as its background) from the same css file.. something in Cakephp is overriding the body background-image setting, but I can't figure out what.


Place images in webroot/img

Place CSS in webroot/css


Write relative paths to references images in CSS styles:

background: url('../img/imagename.png');


You spelling for background is wrong:

ackground-image: url('/root/Desktop/bg1.jpg');

If that is not the case in your actual code, make sure that you are specifying the correct path, try adding a dot before /root/

background-image: url('./root/Desktop/bg1.jpg');
0

精彩评论

暂无评论...
验证码 换一张
取 消