0

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 fine 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.

2 Answers 2

4

Place images in webroot/img

Place CSS in webroot/css


Write relative paths to references images in CSS styles:

background: url('../img/imagename.png');
Sign up to request clarification or add additional context in comments.

Comments

1

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');

4 Comments

oh that was a mistake that must've happened when I pasted it in.. its spelled fine in the css and not working (I edited my OP)
Its not a file path issue, I can display the same image within a DIV in the same CSS file, something with Cakephp is overriding the background-image setting for the body
@Rick: Try this then background-image: url('/root/Desktop/bg1.jpg') !important;
I got it to work, I think it had something to do with my layout file, just a dumb error on my part.. I appreciate your help in this

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.