Solved

Drupal 7 does not show images from css

Posted on 2013-01-18
2
442 Views
Last Modified: 2013-01-18
Dear Experts,

I have drupal 7 website installed on a local MAMP server. For some reason the images from pages.css file don´t show up.

For example, my images are store in:
/Users/Me/Documents/Web/MySites/WebTest/drupal/sites/all/themes/webest/images/logo.png

From the css file, this is how I call the image:

background: url("/sites/all/themes/webtest/images/logo.png") no-repeat scroll 0 0 transparent;

I´ve tried also using absolute path but it does not work either.

Could you please help me?

Thanks,

Winter
0
Comment
Question by:glepiza
2 Comments
 
LVL 13

Accepted Solution

by:
Arrow_1 earned 300 total points
ID: 38793989
I imagine your url looks something like this when viewing your site locally:
http://localhost/WebTest/drupal

Open in new window

In which case your css would be:
background: url("/WebTest/drupal/sites/all/themes/webtest/images/logo.png") no-repeat scroll 0 0 transparent;

Open in new window


But generally you'd want to use a path relative to your css file. For example if your css file is located in:

/Users/Me/Documents/Web/MySites/WebTest/drupal/sites/all/themes/webest/css/style.css

You would want your css to be:
background: url("../images/logo.png") no-repeat scroll 0 0 transparent;

Open in new window

0
 

Author Closing Comment

by:glepiza
ID: 38794565
Thanks!!, you were totally right!
0

Featured Post

Simplifying Server Workload Migrations

This use case outlines the migration challenges that organizations face and how the Acronis AnyData Engine supports physical-to-physical (P2P), physical-to-virtual (P2V), virtual to physical (V2P), and cross-virtual (V2V) migration scenarios to address these challenges.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Suggested Solutions

If you are running a LAMP infrastructure, this little code snippet is very helpful if you are serving lots of HTML, JavaScript and CSS-related information. The mod_deflate module, which is part of the Apache 2.2 application, provides the DEFLATE…
If your site has a few sections that need to be secure when data is transmitted between the server and local computer, such as a /order/ section for ordering or /customer/ which contains customer data, etc it would of course be recommended to secure…
Along with being a a promotional video for my three-day Annielytics Dashboard Seminor, this Micro Tutorial is an intro to Google Analytics API data.
A short tutorial showing how to set up an email signature in Outlook on the Web (previously known as OWA). For free email signatures designs, visit https://www.mail-signatures.com/articles/signature-templates/?sts=6651 If you want to manage em…

776 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question