Solved

What is ./ in HTML?

Posted on 2009-04-08
8
204 Views
Last Modified: 2012-05-06
Hi All,

Simple HTML question.

What does  ./  do in HTML

-i.e.


<a href="./index.html">index</a>
0
Comment
Question by:detox1978
8 Comments
 
LVL 7

Expert Comment

by:gudii9
Comment Utility
it basically maps URLs to Filesystem locations ( references based on root, user directory etc)
0
 
LVL 2

Author Comment

by:detox1978
Comment Utility
That's what i thought, but i'm using a PHP script and it returns file not found?


Any ideas why?
0
 
LVL 2

Author Comment

by:detox1978
Comment Utility
Sorry i should have said, it stays with the folder instead of going to the root....

any ideas why?
0
 
LVL 3

Assisted Solution

by:GarthSnyder
GarthSnyder earned 50 total points
Comment Utility
In short, the "./" does nothing.

This is really a URL question, not an HTML question, and URLs follow UNIX path semantics. In that system "." is the name of the current directory and / is just the path separator. So "./index.html" is completely equivalent to "index.html".

If the file isn't found, make sure the current HTML BASE is really pointing at the parent URL of that index.html file.
0
Highfive Gives IT Their Time Back

Highfive is so simple that setting up every meeting room takes just minutes and every employee will be able to start or join a call from any room with ease. Never be called into a meeting just to get it started again. This is how video conferencing should work!

 
LVL 16

Assisted Solution

by:hankknight
hankknight earned 50 total points
Comment Utility
"./index.html" is equivalent to "index.html" however ./ is not useless and redundant.  Use ./ when you want to go to the index of the current directory.

For example, this could NOT be done any other way than with ./:
    <a href="./">Index</a>

0
 
LVL 3

Accepted Solution

by:
Duboux earned 150 total points
Comment Utility
In easy language:

./ stands for the current folder the page you're looking at in your browser is also in.
../ is a folder above it.
../../ is the folder above that one..

for example, the script/page you're linking in, is in this folder:
folder1 / folder2 / folder3 / your_page.html
./ = folder1 / folder2 / folder3 /
../ = folder1 / folder2 /
../../ = folder1 /

it's tidy to use ./
but defenately not necessary ;)
0
 
LVL 13

Expert Comment

by:qwerty021600
Comment Utility
See if you want to refer to an image which is separate folder. For Example
You have this folder structure :
One folder which contain all the images and CSS.

So if in a class in CSS, you refer to any background image. you'll give the path ./ for the image as the CSS and image are in the same folder.
0
 
LVL 2

Author Closing Comment

by:detox1978
Comment Utility
thanks,
0

Featured Post

Free Trending Threat Insights Every Day

Enhance your security with threat intelligence from the web. Get trending threat insights on hackers, exploits, and suspicious IP addresses delivered to your inbox with our free Cyber Daily.

Join & Write a Comment

When writing CSS, there are a few simple rules that will make your life easier.    1. Using ‘* {box-sizing:border-box;}’. Using this will wrap all your elements in a nice little compact box-model that will give you the width you want, like so... …
Not sure what the best email signature size is? Are you worried about email signature image size? Follow this best practice guide.
In this tutorial viewers will learn how to embed Flash content in a webpage using HTML5. Ensure your DOCTYPE declaration is set to HTML5: "<!DOCTYPE html>": Use the <object> tag to embed Flash content.: To specify that the object is Flash content, d…
The viewer will learn the basics of jQuery including how to code hide show and toggles. Reference your jQuery libraries: (CODE) Include your new external js/jQuery file: (CODE) Write your first lines of code to setup your site for jQuery…

762 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

Need Help in Real-Time?

Connect with top rated Experts

8 Experts available now in Live!

Get 1:1 Help Now