my links using html aren't working? - html

So I'm working on a website
<img src="Images/PaintEverythingPreview.png" herf="Pages/PaintEverything.html">
<p> - <a herf="Pages/PaintEverything.html">
Paint Everything
</a> - </p>
and the code here isn't working, none of the links work! I've coded a little program on my website, and this is supposed to take you to it, but it's not working, please help!

Use href instead of herf.
Paint Everything
HTML Tags

The correct way to include a link in your HTML is to use the href element (you mis-spelt it as herf.
Secondly, you cannot use href inside an img tag as it's not valid HTML. Instead, you should nest the img tag inside the link.
Update your code to this:
<a href="Pages/PaintEverything.html">
<img src="Images/PaintEverythingPreview.png">
</a>
<p>
Paint Everything
</p>
To validate (check) your HTML in the future, try the W3C Validator

error writing the attribute href.
Paint Everything
error in attribute href in img tag (not exists):
<img src="Images/PaintEverythingPreview.png" herf="Pages/PaintEverything.html">
html tag reference: HTML tags list

Change herf to href and enclose the img in <a> tags to make the image a clickable link.
<img src="Images/PaintEverythingPreview.png">

Firstly you need to remove href from the image tag, since you cannot put a href in an <img> tag.
Secondly you need to check if the path/link to which you want to redirect to, is correct or not.
I have updated your code and let me know if this is what you are looking for.
<img src="Images/PaintEverythingPreview.png"><p> - Paint Everything - </p>

Related

Add link code to this bottom code

Haw can i add a link to this code ?
<span style="background-color:#81d742;">Title</span>
this code is for a bottom in a website and i want it to have a link .
Thank you
You are allowed to put a tags inside span
<span style="background-color:#81d742;">Title</span>
Why would you need a <span>? You can just change the tag to a <a> tag:
<a style="background-color:#81d742;" href="http//mysite.com">Title</a>
You can simply do so by using anchor tag, i.e. a tag
For example, if you wish to link google.co, you can do so by following commands,
Google

Anchor Tags Not Working

I am making a page where I want the links from my navigation to jump to their corresponding anchor tags in the page, however when I click the links the page does not jump at all.
The code for my page is here:
https://github.com/harlanplatz/harlanplatz.github.io/blob/gh-pages/index.html
I have worked with anchor tags before and am not sure why this may not be working.
OK Thanks Justin, it looks like you are just missing some linkage in your named anchor (<a></a>) tags.
Remember that you must name your destination anchor <a> tag. So:
<a name='example'><h1>Cool story bruh</h1</a>
Then, to link to it, make sure you use #anchorname in your link <a> tag. So:
<a href='#example'>Read a cool story</a>.
So you are matching the part after the # in your link href to the name attribute in the anchor you want to jump to. I don't see this going on in your HTML.

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>

HTML and CSS href don't work

i made this page yesterday and href links doesn't work...
HTML and CSS source here: https://titanpad.com/jmAHmU3GyI
I may not understand exactly what you're asking, but the href attribute belongs inside an anchor tag, like so:
<td>Link</td>
Specification: http://www.w3schools.com/tags/att_a_href.asp
Demo: http://jsfiddle.net/0mtto06n/
You are using the href attribute on <li> elements which is unfortunatelly not going to work. To create links use Link text
Read more here:
about a tag

Why does href appear not to work with id?

<h1><a id="Didn't-answer-your-question?">Didn't answer your question?<!--ID end--></h1></a><!--link end-->
Can I have an id element inside a href element, for the link text or does this not work, if so do people have an alternative?
There are several problems with your markup.
You don't close the <h1> tag properly. Your <a> id may technically work, but I wouldn't recommend it as an element ID.
The one that's giving you an issue though is the fact that you have an <a> tag nested inside another <a> tag. That is not valid markup.
Your inner tag does not need to be an anchor tag, change it to a span or something and it should work fine.
<a href="http://www.website.com">
<h1>
<span id="Didn't-answer-your-question??">Didn't answer your question?</span>
<!--ID end-->
</h1>
</a>
<!--link end-->
You didnt properly close the h1 tag but other than that it looks like it should work.
This is from the w3 website:
I just returned from vacation! Here's a
<A id="anchor-two">photo of my family at the lake.</A>.
http://www.w3.org/TR/html401/struct/links.html#h-12.2.3