How to go up a level in the src path of a URL in HTML?
Use ..
to indicate the parent directory:
background-image: url('../images/bg.png');
How do I put a hyperlink to two levels above in the directory tree ?
You can use ../index.html
to refer to index.html
in the parent directory.
Going a level up in the src path of the script src= /script tag in HTML
Your Hide function is not bound to any event. Which event do you wish to trigger the hide function? I belive you wish to fire it when you open the page right? But when you open the page script runs before the elements are created and there are no h1 to find it and hide it. if you wrap it with
$(document).ready(function(){
$('h1').hide();
});
Now it will wait for the document to create elements then run hide() function.
Another Scenario is you want to hide it when you click a button, then
$(document).ready(function(){
$('button').click(function(){
$('h1').hide();
});
});
Now, it waits all the elements to be ready then bind hide() function to button's click event.
How to set relative path to current folder?
Just dot is working. The doctype makes a difference however as sometimes the ./ is fine as well.
<a href=".">Link to this folder</a>
Specifying the path to directories in HTML
Your problem is that all files should be in public_html
folder ,all other folders in the same level of public html aren't accessible by public.
Move all your folders to public_html
and change path of your css file in index.html :
<link rel="stylesheet" type="text/css" href="css/styles.css">
Having links relative to root?
A root-relative URL starts with a /
character, to look something like <a href="/directoryInRoot/fileName.html">link text</a>
.
The link you posted: <a href="fruits/index.html">Back to Fruits List</a>
is linking to an html file located in a directory named fruits
, the directory being in the same directory as the html page in which this link appears.
To make it a root-relative URL, change it to:
<a href="/fruits/index.html">Back to Fruits List</a>
Edited in response to question, in comments, from OP:
So doing / will make it relative to www.example.com, is there a way to specify what the root is, e.g what if i want the root to be www.example.com/fruits in www.example.com/fruits/apples/apple.html?
Yes, prefacing the URL, in the href
or src
attributes, with a /
will make the path relative to the root directory. For example, given the html page at www.example.com/fruits/apples.html
, the a
of href="/vegetables/carrots.html"
will link to the page www.example.com/vegetables/carrots.html
.
The base
tag element allows you to specify the base-uri for that page (though the base
tag would have to be added to every page in which it was necessary for to use a specific base, for this I'll simply cite the W3's example:
For example, given the following BASE declaration and A declaration:
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01//EN"
"http://www.w3.org/TR/html4/strict.dtd">
<HTML>
<HEAD>
<TITLE>Our Products</TITLE>
<BASE href="http://www.aviary.com/products/intro.html">
</HEAD>
<BODY>
<P>Have you seen our <A href="../cages/birds.gif">Bird Cages</A>?
</BODY>
</HTML>
the relative URI "../cages/birds.gif" would resolve to:
http://www.aviary.com/cages/birds.gif
Example quoted from: http://www.w3.org/TR/html401/struct/links.html#h-12.4.
Suggested reading:
- http://www.motive.co.nz/glossary/linking.php
- http://www.communitymx.com/content/article.cfm?cid=AEDCC52C4AD230AD
How to navigate folders in HTML/Atom
Try this:
<link rel="icon" href="../Images/favicon.ico">
Related Topics
How to Uninstall a Service Worker
How to Find Unused Images and CSS Styles in a Website
What Is the HTML Tabindex Attribute
Making the Main Scrollbar Always Visible
Multiple Radio Button Groups in One Form
Apply CSS Styles to an Element Depending on Its Child Elements
Common Header/Footer With Static Html
Stretch Text to Fit Width of Div
Float Does Not Work in a Flex Container
Css ''Background-Color" Attribute Not Working on Checkbox Inside ≪Div≫
How to Style Part of an Input Field'S Value
How to Update Non-Jsf Components (Plain Html) With Jsf Ajax
Text-Overflow Is Not Working When Using Display:Flex
Full Width Backgrounds on Outlook '07/'10/'13
Best Approach to Real Time Http Streaming to Html5 Video Client
Iframes and the Safari on the iPad, How Can the User Scroll the Content