473,382 Members | 1,349 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,382 software developers and data experts.

images not displaying on my site - relative image paths in CSS

I'm somewhat new to this so I know there is something easy I'm missing. I'm editing an existing html page that was built with primarily with css. I have to work with the existing structure and not change it.

The background is in this style

Expand|Select|Wrap|Line Numbers
  1. #content-wrapper-1 {
  2.     background-color: #d8f5fd;
  3.     background-image: url(/images/backgrounds/content-1.png);
  4.     background-repeat: repeat-y;
  5.     background-position: center 0;
my image is not displaying:
Expand|Select|Wrap|Line Numbers
  1.  <div id="content-wrapper-1"> </div>
Can you tell me what the difference is when I have my image path start with a "/" (example /images/backgrounds/content-1.png) verses " ..//" (which I understand means go up one directory and then go into the folders indicated) verses ( foldername/image.gif), which I know means go into that folder and find the image.

I can't move the folder structure around, so I need to figure out how to navigate to the images.

Thanks for any help. Sorry if this is a very basic question.
Aug 24 '08 #1
5 3996
eWish
971 Expert 512MB
Do you have content in the div 'content-wrapper-1'? Are the images in the proper directory? What browser are you using because IE has issues with displaying png files that are transparent. I would suggest that you use an absolute url.

--Kevin
Aug 24 '08 #2
Yes, I do have content in the wrapper, and I'm trying to follow the existing code, so I didn't want to change the way it was done

if the image path is written: /images/backgrounds/content-wrapper-1.png

what does the slash in front of images mean? maybe I don't have them set up correctly.
Aug 24 '08 #3
David Laakso
397 Expert 256MB
Yes, I do have content in the wrapper, and I'm trying to follow the existing code, so I didn't want to change the way it was done

if the image path is written: /images/backgrounds/content-wrapper-1.png

what does the slash in front of images mean? maybe I don't have them set up correctly.
Seek the directory...

Use your editor to find the image and set its path, or try these manually
Expand|Select|Wrap|Line Numbers
  1. Try: ../
  2. background-image: url(../images/backgrounds/content-1.png);
  3. Or: no first forward slash
  4. background-image: url(images/backgrounds/content-1.png);
  5.  
Aug 24 '08 #4
drhowarddrfine
7,435 Expert 4TB
A leading slash always indicates 'root' while ../ always indicates one level up from the current directory.
Aug 24 '08 #5
eWish
971 Expert 512MB
The single forward slash at the beginning means to point to the root directory.

Two dots ("..") are used for moving up in the hierarchy, to indicate the parent directory; one dot (".") represents the directory itself. Both can be components of a complex relative path (e.g., "../mark/./bobapples"), where "." alone or as the first component of such a relative path represents the working directory. (Using "./foo" to refer to a file "foo" in the current working directory can sometimes be useful to distinguish it from a resource "foo" to be found in a default directory or by other means; for example, to view a specific version of a man page instead of the one installed in the system.)
--Kevin
Aug 24 '08 #6

Sign in to post your reply or Sign up for a free account.

Similar topics

3
by: Peter Taurins | last post by:
Hi there. I have an included file (header.php) that contanis a reference to a graphic. If I stay at the root level, then I can control the relative path of the image. eg. images/imagename.jpg ...
0
by: api | last post by:
I'm using XSL stylesheets and XML documents to generate PDF files with xsltproc, then fop. The problem is, I can't get images to show up in the PDF (the text showing up in the fo file, though). ...
4
by: Bernie Raffe | last post by:
When I change the 'cookieless' flag in the WebConfig file to true, everything works fine on my local PC, but the images fail to appear when using the remote server. I specify my images...
15
by: Jameson | last post by:
Happy New Year, Everyone! I am trying to figure out how to display a bunch of images (mainly JPEGs, but possibly a few GIFs and PNGs as well) that are stored in a local directory on the system....
4
by: JoJo | last post by:
I followed along in Jeremy Keith's book "DOM Scripting" on how to make a image viewer that changes on clicking links. It is up for demo at: http://jojowebdesign.com/dom1.html My question is...
12
by: John Kotuby | last post by:
Hi all, Maybe this is a simple problem found in ASP.NET 2.0 course 101, but I must have missed it. When I create a page in Visual Web Developer and use URLs like "/images/picture.gif " or a link...
3
by: ABCL | last post by:
Hi I have asp.net web site that is working well on my m/c if I access using http:// But I depyoed on production,It requiers to use https:// , If i browse tha page using https://...and on login...
3
by: John Kotuby | last post by:
I have just upgraded to a new development machine that came with Vista ultimate. I am developing a website with VS2005 and VB. My image and css references in my source code are all relative. For...
5
matheussousuke
by: matheussousuke | last post by:
Hello, I'm using tiny MCE plugin on my oscommerce and it is inserting my website URL when I use insert image function in the emails. The goal is: Make it send the email with the URL...
1
by: CloudSolutions | last post by:
Introduction: For many beginners and individual users, requiring a credit card and email registration may pose a barrier when starting to use cloud servers. However, some cloud server providers now...
0
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 3 Apr 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome former...
0
by: ryjfgjl | last post by:
In our work, we often need to import Excel data into databases (such as MySQL, SQL Server, Oracle) for data analysis and processing. Usually, we use database tools like Navicat or the Excel import...
0
by: Charles Arthur | last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
0
by: aa123db | last post by:
Variable and constants Use var or let for variables and const fror constants. Var foo ='bar'; Let foo ='bar';const baz ='bar'; Functions function $name$ ($parameters$) { } ...
0
by: ryjfgjl | last post by:
If we have dozens or hundreds of excel to import into the database, if we use the excel import function provided by database editors such as navicat, it will be extremely tedious and time-consuming...
0
by: ryjfgjl | last post by:
In our work, we often receive Excel tables with data in the same format. If we want to analyze these data, it can be difficult to analyze them because the data is spread across multiple Excel files...
0
by: emmanuelkatto | last post by:
Hi All, I am Emmanuel katto from Uganda. I want to ask what challenges you've faced while migrating a website to cloud. Please let me know. Thanks! Emmanuel
1
by: Sonnysonu | last post by:
This is the data of csv file 1 2 3 1 2 3 1 2 3 1 2 3 2 3 2 3 3 the lengths should be different i have to store the data by column-wise with in the specific length. suppose the i have to...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.