View Full Version : cant access picture
gurmeet
10-11-2009, 05:47 AM
hi,
i am using a picture as a button, the pathe of the pictur is lik this:-
mydir > img > picture.gif (this is the path of image file)
mydir > css > style.css (this is the path of css files)
my css file is lying in diff directory and image in diff dir... so how i can access it by using relative path only?
bluewalrus
10-11-2009, 08:21 AM
../
or
./
not sure off topp of head fiddle with that though or post link
Schmoopy
10-11-2009, 10:46 AM
.example{
background:url('../img/picture.gif');
}
jscheuer1
10-11-2009, 03:11 PM
Just a fine point here, but unless we are talking about a background image, as is generally not the case with an input of the type="image", the image must be hard coded as the src attribute of the input. If you do have an input of the type="button" it can have a css background image associated with it from the stylesheet, but this may not always appear as expected on the button, different browsers may treat it quite differently.
In general, relative paths in the stylesheet are relative to the stylesheet, not to the page on which the style gets used. As far as I know, the only exception is with IE proprietary 'styles' like .htc behaviors and filters which are also part javascript and must be relative to the page that uses them.
In all cases though, the absolute or network paths may be used, and often cause less confusion.
An absolute path includes the full URL (href if you will):
http://www.domain.com/path/filename.ext
and a network path uses the / to denote the root of the domain (on a local system though this will be the root of the drive):
/path/filename.ext
Powered by vBulletin® Version 4.2.2 Copyright © 2021 vBulletin Solutions, Inc. All rights reserved.