Sniffy Posted November 5, 2006 Share Posted November 5, 2006 I was wondering how I could access a file in a parent directory in an html anchor?Or for instance, say my stylesheet is in the parent directory and I'm in sub-directory "users", what code would I use to access it? Link to comment Share on other sites More sharing options...
croatiankid Posted November 5, 2006 Share Posted November 5, 2006 put 2 periods in the href/src. for example, to get an image one directory up, use src="../image.jpg". you could also enter another directory, for example, src="../directory/image.jpg". To go two directories up, you use src="../../image.jpg", for three src="../../../image.jpg" and so on Link to comment Share on other sites More sharing options...
Chocolate570 Posted November 5, 2006 Share Posted November 5, 2006 Suppose you were on domain www.something.com. Your current HTML page is www.something.com/hello/omg/what/hello.html.This stylesheet link would access www.something.com/hello/style.css<link ref="stylesheet" href="../style.css" />But if you wanted to access something.com/style.css, you'd use:<link ref="stylesheet" href="/style.css" />I think. Link to comment Share on other sites More sharing options...
Sniffy Posted November 5, 2006 Author Share Posted November 5, 2006 Thanks, guys. Link to comment Share on other sites More sharing options...
Skullmonkey Posted November 5, 2006 Share Posted November 5, 2006 Just to let you guys know, you dont need the '..' if its going from the root directory. Link to comment Share on other sites More sharing options...
Sniffy Posted November 5, 2006 Author Share Posted November 5, 2006 Of course not, we're discussing parent directories. Link to comment Share on other sites More sharing options...
Skullmonkey Posted November 5, 2006 Share Posted November 5, 2006 ah. Link to comment Share on other sites More sharing options...
Recommended Posts
Create an account or sign in to comment
You need to be a member in order to leave a comment
Create an account
Sign up for a new account in our community. It's easy!
Register a new accountSign in
Already have an account? Sign in here.
Sign In Now