1

Just started building a website and its my first time using MAMP and CodeIgniter Framework. I am trying to get images from the CSS code to display but they are not showing up when I open the website in the localhost. My question is:

Do I need to put the images in a specific location in MAMP's docs? or is there something I am not configuring first?...(I bet its something tiny I have not done..) Just to note I have tried changing the URL and file location a few times but had no luck..

Here is the CSS code which links to the image I am trying to display, everything else works except the images are not displaying.

Please help.

#header {
overflow: hidden;
width: 1000px;
height: 50px;
margin: 00px auto 20px auto;
background: url(/Applications/MAMP/htdocs/website/application/views/images/img03.jpg) no-repeat right top;
}
2
  • 3
    Try changing /Applications/MAMP/htdocs/website/application/views/images/img03.jpg to /application/views/images/img03.jpg Commented Mar 11, 2013 at 19:45
  • thanks for the reply, I tried this and changing URL's a few times but still no luck :( Commented Mar 11, 2013 at 19:51

2 Answers 2

4
background: url(/Applications/MAMP/htdocs/website/application/views/images/img03.jpg)

"localhost" points to htdocs, you must set starting the route from there

background: url(/website/application/views/images/img03.jpg)

can use with F12 if you use chrome if the correct path to the image

Sign up to request clarification or add additional context in comments.

3 Comments

Thanks for your help, I tried this as well but no luck..I forgot to mention I was using CodeIgniter in the question so I don't know if that helps answer a few questions?..
CSS, JAVASCRIPT, IMAGES, ETC is allowed to be accessed directly, maybe you should create a directory "static" for these files in root of your directory
Fixed it! Needed to create a folder in the main website folder rather than under application. Thanks for your help!
1

Change your images path. For example, if you have your css file in a folder called css, your images are in views and the 2 folders are on the same level:

background: url(../views/images/img03.jpg) no-repeat right top;

7 Comments

thanks for the reply, I tried this and changing URL's a few times but still no luck
you have to show your folder structure.. your paths are the issue without doubts
Probably would of helped if I actually informed everyone what Framework I am using :s ...I am using CodeIgniter so its under their file structure if that helps?
nope, it still doesn't tell where is your CSS. Can you provide the path, like you did for the image - /Applications/MAMP/htdocs/website/application/views/images/img03.jpg?
The CSS is in a folder css inside the views folder and that displays fine
|

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.