How make a div link to another page? - html

Something isn't right! I am trying to link this div to another page but it keeps giving me 404 error when I click it. I tried replacing the page with google.com and it worked fine! I know this page works because if i run it alone in a browser it works fine! Whats going on??
<a style="display:block" href="../unitedStates.php">
<div id="regionsUnitedStates" class="not-open regionsButton">
<div id="regionsUnitedStatesTooltip"></div>
</div></a>

You href your div to parent directory with "../". Instead this use :
<a style="display:block" href="/unitedStates.php">

your path in href is doesnot exists. Try checking the absolute url of your path in browser and add it in href.

Related

Relative path not working for one element in header menu?

I have this code in my new.php file, which is contained within a folder called contacts in my main website:
<a href="../index.html" id="header-link">
<img src="../images/menuslf100logo.png" id="header-img" />
</a>
When I go to the website and navigate to contacts/new.php and try to click the link, however, it shows up as contacts/index.html and breaks. Using inspect element, the code shows up like so:
<a href="index.html" id="header-link">
<img src="../images/menuslf100logo.png" id="header-img" />
</a>
I honestly have never seen this before. There are three other links in the header that use the same relative path format and they all work perfectly fine. It's just this one that is screwing with me. Has anybody seen this? Is there a fix for it? I've tried deleting the line, saving, and pasting it back in and saving again. No luck. Also tried going with an absolute path by removing the '..'. Didn't change anything. I then moved this link below the next link down just for fun but nothing happened.
Updated with image of file directory:

Go to external url?

Okay, this is so simple yet I don't know how to do it.
I use vhost that makes localhost/wamp/www/blog/public become blog.dev
sample:
Stack Overflow
expected result: go to stackoverflow.com
what it actually does: go to blog.dev/stackoverflow.com
So, how should I do?
First of all, if you use a relative URL like above, your browser will assime that it's a URL relative to the URL you're currently browsing. That's why
<a href="stackoverflow.com">
links to blog.dev/stackoverflow.com
Replace
<a href="stackoverflow.com">
with the absolute URL
<a href="http://stackoverflow.com">
to get what you need.
Secondly, you could add target attribute to your URL if you want to open the link in a new window/tab:
<a href="http://stackoverflow.com" target="_blank">

Hyperlinking a page to a local page (in files) HTML

Im trying to set up a hyperlink from my current page to another page via my files, however it doesn't work...
My code:
<ahref="file:///C:/Users/ashsa_000/Desktop/Html/6weeksproject/Index/Languages.html"><input type="image" id="Languages" position:absolute style="height:px; width:px;" src="./CSImages/About.PNG">
<!-- Thats in context, the HREF is following-->
<ahref="file:///C:/Users/ashsa_000/Desktop/Html/6weeksproject/Index/Languages.html">
Once i click the hyperlink it comes up with an error that repeats the directory:
file:///C:/Users/ashsa_000/Desktop/Html/6%20weeks%20project/file///C:/Users/ashsa_000/Desktop/Html/6%20weeks%20project/Index/Languages.html
How can i fix this?
First of all, the tag in conjunction with the href attribute work as follows <a href="path/to/file.html">. Noticed the difference (space)?
Secondly, if the file is in the same folder, all you need to do is reference the file that you want to link starting from that path and upwards.
You were on the right track, your href would become: {}
Consider naming files with lowercase letters only. Its not necessary, but a well accepted practice!
The <a> must have a space between the a and href: <a href="">
When you use the href attribute, the path will be based on which file you put the <a> in, e.g. if you put the <a> in the index.html, and you want to reference to languages.html, first make sure that the languages.html is in the same folder as index.html (easier) and then just reference to it with:
<a href="languages.html">
Also, why are you using an input tag? Just use an img tag. I'll fix your code:
<a href="languages.html">
<img id="Languages" style="position: absolute; height:_px; width:_px;" src="CSImages/About.PNG">
</a>
This only works if the folder CSImages is in the same directory as index.html If not, just change the path accordingly.
Hope this helps!
<a href="file:///C:/Users/ashsa_000/Desktop/Html/6weeksproject/Index/Languages.html">
<input type="image" id="Languages" position:absolute style="height:px; width:px;" src="./CSImages/About.PNG">
</a>
As mentioned in comments, you should put a space between a and href. Additionally, you should close the a tag.
Why are you using an input element for showing an image? Maybe you are better off with an actual image tag:
<a href="file:///C:/Users/ashsa_000/Desktop/Html/6weeksproject/Index/Languages.html">
<img id="Languages" style="position:absolute; height:[insert missing value]px; width:[insert missing value]px;" src="./CSImages/About.PNG">
</a>
You may also have a look at this SO question for more reference on links to local files: How can I create a link to a local file on a locally-run web page?
Add the space in the a href, put the image in an img tag, and don't include height and width unless you are going to include a value. Also position:absolute has to go in a style tag. Finally, close your a tag.
<a href="file:///C:/Users/ashsa_000/Desktop/Html/6weeksproject/Index/Languages.html">
<img src="./CSImages/About.PNG" style="position:absolute">
</a>

Links redirecting to "#"

I'm trying to create a menu on a website, and it keeps redirecting to the page I'm creating no matter what I put in the href tags. I can't figure out what's causing it, I figured maybe another set of eyes could help me figure it out.
https://gist.github.com/b3f3abc42c517c8ba7ab
EDIT: fixed link
it is
file
and not
<a href src="http://adammcgee.com/clients/sdaysrodeo/file.html">file</a>
the attribute src is used with
<img>
for example
<img src="image.gif">
the address you give us for you gist is bad.
it is not
https://gist.github.com/b3f3abc42c517c8ba7ab.git
but
https://gist.github.com/b3f3abc42c517c8ba7ab
without "git" at the end
then the only link I found in your menu is not correct.
it is
<a href src="http://adammcgee.com/clients/sdaysrodeo/sdays-rodeo/announcer/#">PRCA</a>
it should nor finish by a "#" and you should have the extension of the page, like :
http://adammcgee.com/clients/sdaysrodeo/sdays-rodeo/announcer/page.html

Anchor link not working when clicked

Sooo.. I've got this navigation on the frontpage. I'm trying make it link to an anchor on another page.
www.oddfuse.com
This is the anchor link:
<a class="hover" title="Skills" href="/page#skills">
As you can see, it does not redirect to the specified page.
However it does work when typed directly into the address bar:
www.oddfuse.com/page#skills
This also works:
<a class="hover" title="Skills" href="/page">
But with the hash, I get no response whatsoever.
Any ideas on how I fix this?
Okay, so it turned out that it was the jQuery Mobile somehow messing with the anchor tags.
I needed to put data-ajax="false" in the link, and it now works perfectly. TMYK.
Found the solution here
can you try including the file extension?
i.e.
<a class="hover" title="Skills" href="/page.html#skills" />
I'm wondering if it thinks the # is part of a file name that can't be found.
If you want a link to jump a specific location on a different page, you'll need to replace #anchor with the full URL for the target page, similar to:
<a class="hover" title="Skills" href="http://oddfuse.com/page/#skills">