473,387 Members | 1,516 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,387 software developers and data experts.

How can a css in a folder read a pics in another folder

I have css in a folder name css. so how can this .css file read a pics file
from another folder eg, pics/a.jpg.

Both css folder and pics folder are located in a folder named project.

I know i can call the pic by url(project/pic/a.jpg)

However, its very inconveninet when I change the folder name eg from project
to project10.

so, are there any other way to do this?

Please advice. Thanks!

Jul 20 '05 #1
4 15050
/Jorntk/:
I have css in a folder name css. so how can this .css file read a pics file
from another folder eg, pics/a.jpg.

Both css folder and pics folder are located in a folder named project.

I know i can call the pic by url(project/pic/a.jpg)
If the above statement is placed in a "project/css/the.css" file
(for example) the URI for the "a.jpg" would resolve to
"project/css/project/pic/a.jpg". You should use 'url(../pic/a.jpg)'
if you have:

project/
css/the.css
pic/a.jpg

<http://www.w3.org/TR/CSS21/syndata.html#uri>:
For CSS style sheets, the base URI is that of the style sheet, not
that of the source document.


--
Stanimir
Jul 20 '05 #2
Jorntk wrote:
I have css in a folder name css. so how can this .css file read a
pics file from another folder eg, pics/a.jpg.

Both css folder and pics folder are located in a folder named
project.

I know i can call the pic by url(project/pic/a.jpg)
ITYM, url("/project/pic/a.jpg")
However, its very inconveninet when I change the folder name eg from
project to project10.
In order:

(a) don't change sub directory ("folder") names
(b) use server redirects
so, are there any other way to do this?


(c) put the image in the same directory ("folder") as css file

--
Brian (remove "invalid" from my address to email me)
http://www.tsmchughs.com/
Jul 20 '05 #3
Jorntk wrote:
I have css in a folder name css. so how can this .css file read a
pics file from another folder eg, pics/a.jpg.

Both css folder and pics folder are located in a folder named
project.

I know i can call the pic by url(project/pic/a.jpg)

However, its very inconveninet when I change the folder name eg from
project to project10.

so, are there any other way to do this?


I somehow missed the obvious. Given subdirectory for css

/project/

and subdirectory for images

/project/pic/

use a relative url.

body {
background-image: url("pic/a.jpg");
}

This means, look for "a.jpg" in the subdirectory of whatever directory
has the css file.

(It's still better not to rename things; there are often things you
forget somewhere else in the site that will no longer find files because
of name changes.)

--
Brian (remove "invalid" from my address to email me)
http://www.tsmchughs.com/
Jul 20 '05 #4
Tim
On Sat, 1 May 2004 19:28:13 -0700,
"Jorntk" <jo****@yahoo.com> posted:
I have css in a folder name css. so how can this .css file read a pics file
from another folder eg, pics/a.jpg.

Both css folder and pics folder are located in a folder named project.

I know i can call the pic by url(project/pic/a.jpg)

However, its very inconveninet when I change the folder name eg from project
to project10.


Two ways:

1. Use relative links. Back out of a folder using ../ into the parent, the
append the new name onto the end of it.

e.g. Given some files located at:

/an/example/here.test
/an/other/example.test

The first one (here.test) could refer to the second (example.test)
with a link like "../other/example.test".

2. Use absolute links. All links include the full path to the destination,
starting with a slash / to indicate the root.

e.g. Given those same files as before, they'd each have links using the
full path to the other. The first would refer to the second with a link
like "/an/other/example.test".

Depending on what you mean by changing a folder name, you're in for a hard
time. If you rename things, you've got to make quite a lot of changes on
anything else that referred to it.

--
If you insist on e-mailing me, use the reply-to address (it's real but
temporary). But please reply to the group, like you're supposed to.

This message was sent without a virus, please delete some files yourself.
Jul 20 '05 #5

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

0
by: RS | last post by:
Is there a way to debug a C style DLL from another folder other than the usual debug folder. I have some 3rd party software that I want to interface with, and this software looks for a folder...
35
by: Shyguy | last post by:
Is it possible, and if so how would I read and import folder names from a CD to a table? Thank you for any help.
0
by: Siew-Ming | last post by:
Hi, Try to figure a way to turn off a folder Read-only property for a specific folder (Windows 2003) at multi sites. When we do our application upgrade/patch, we manually turn off the...
6
by: ad | last post by:
I want to copy all files under a folder to another folder. If I use File.Copy(sourceFileName, destFileName, overwrite), it must specify all files name in the source and destionation. How can I...
2
by: Bill Fallon | last post by:
I have a VS2005 VB.Net windows form application deployed to a share drive. The windows explorer security permissions for this application (.exe) file is set for Everyone with List Folder/Read Data...
8
by: paquer | last post by:
Database Users need to have Read/Write etc... permissions to the folder where the Database resides in order to create the lock file. I have read only users. I have set up the Shortcut that links...
5
by: wassimdaccache | last post by:
Hyyy I do have a database that I saved on c:\wasspro\mydb in the folder wasspro I have another folder called image . what i need is to copy folder wasspro into another directory d:\backup ...
2
by: cpet | last post by:
Is it possible to have Access 2003 put the ldb in a different folder that the mdb is in? Thus allowing users Read-only access to the data without having to set up database security.
2
by: swethak | last post by:
hi, i want to copy the contents of one folder into another folder.For that i create the one new folder . I copied the files of already existing folder into new folder.For that i write a code as...
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: 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
0
BarryA
by: BarryA | last post by:
What are the essential steps and strategies outlined in the Data Structures and Algorithms (DSA) roadmap for aspiring data scientists? How can individuals effectively utilize this roadmap to progress...
1
by: nemocccc | last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
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...
0
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However,...
0
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can...
0
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven...

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.