How To Make HTML Links - html

I am trying to make an href button that when clicked changes the image on my website page to another image. How precisely can I do this?
I am trying to use the following code to point "Page 2" to page 2.html doc in my files as to change the image. The file cannot be found however.
<a href=“<a href=“page 2.html”> Page 2</a>
I do apologize if I am vague/if this question has been answered in past--Stack has been immensely helpful for answering my questions in past but I am just very confused as to how to solve this.
Thank you

correct syntax:
<a href="file" >link to be seen on page </a>
so for you:
Page 2
If the file has a space in it, you should put a %20 where the space is:
href="page%202.html

page 2.html shouldn't contain any spaces. Consider this: Page 2

If this is not still working page 2 , try to input the whole file path. eg. page 2 . You may also refer
here

Related

Why is my simple HTML link not working despite seemingly correct code

I create a simple one page website with text using Big Rock's webcreator. I tried to link one of the lines one the page using HTML in the following way:
<a href="iimk.ac.in/faculty-profiles/ASHOK-THOMAS">iimk.ac.in/faculty-
profiles/ASHOK-THOMAS</a>
The hyperlink however is not working. I would like to fix the error in the HTML code.
Try this your link is not correct as it doesn't covers the proper URL of the page:
<a href="https://iimk.ac.in/faculty-profiles/ASHOK-THOMAS">iimk.ac.in/faculty-
profiles/ASHOK-THOMAS</a>
Visit this link to see the proper working of the hyperlink:
https://i.stack.imgur.com/KFSB9.png
your link is not correct with the https formatting so just use this
<a href="https://iimk.ac.in/faculty-profiles/ASHOK-THOMAS">iimk.ac.in/faculty-
profiles/ASHOK-THOMAS</a>

HTML - How to open an a href that leads to a div

So I have two separate HTML files. The first one holds a section with id="portfolio". The second one holds an a href. When I click the a href in the second HTML file I want to go to the first HTML file at the #porfolio section position. I know how to open the first HTML file from the a href. I also know how to get to the #porfolio section from the first HTML file. What I don't know is how can get to the #portfolio section in the first HTML file through the second HTML file. So how can I do that? Thanks in advance!
First HTML:
<section class="no-padding" id="portfolio">
...
</section>
Second HTML:
<a class="page-scroll" href="#portfolio">Portfolio</a>
This should work when included in second.html:
<a class="page-scroll" href="first.html#portfolio">Portfolio</a>
To clarify: you have 2 pages open in a webbrowser (the same webbrowser) and you want to jump back and forth between the 2 different pages, causing the web browser to change tabs/windows and re-display the requested page(s) at the anchor point you specify.
You need to talk to webbrowser and get it to do the work for you. The answer is browser specific.
I would start by creating child page (target='_blank') of original page and seeing what individual browsers allow you to get away with. Your mileage may vary, as they say.

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

linking to another part of the same page

I've been looking around online for a solution but the methods I've found don't work. The methods online tell me to do this
Make a div with a class and ID
I make one like this
<div class="paragraphBackground" id="paragraphBackground">
<p class="paragraphContent">content of paragraph</p></div>
then it says to make a link like o have below.
Goto paragraph
But when I click on the goto paragraph it doesn't do anything.
What I'm wanting to use this for is a html readme for a mod that contains a sidebar on the left that shows all the contents of the readme and when you click on one of the links it will jump you to that section in that same HTML file.
Are you looking for something like this?
http://jsfiddle.net/huntmg90/
Basically you set a <a name="identityofanchor" /> in front of your text you want linked, then to link to it you do a label of anchor
Just use the following for the link: <a href="#readme">.
For the part that you want to scroll to, use this: <div id="readme">Read me!</div>
JSFIDDLE HERE.
Your link will need to look something like this:
Paragraph 1
And the corresponding content needs to have:
<a name="paragraph1">Paragraph 1</a>
Here's a Fiddle to help: http://jsfiddle.net/m0nk3y/9mx5yx7d/

Getting a link to go to a specific section on another page

I have a link on one page that needs to go to a different page, but load to a specific section on that other page.
I have done this before with bootstrap but they take all the 'coding' out of it, so I need to know how to do from scratch. Here is the markup I have based on this link (not the best resource, I know): http://www.w3schools.com/html/html_links.asp
**Page One**
<a href="/academics/page.html#timeline> Click here </a>
**Page I am linking to**
<div id="timeline" name="timeline"> ... </div>
Can I do this with just HTML, or do I need some JavaScript? If I need to do it via JS, it needs to be on the target page, right?
I believe the example you've posted is using HTML5, which allows you to jump to any DOM element with the matching ID attribute. To support older browsers, you'll need to change:
<div id="timeline" name="timeline" ...>
To the old format:
<a name="timeline" />
You'll then be able to navigate to /academics/page.html#timeline and jump right to that section.
Also, check out this similar question.
You can simply use
<a href="directry/filename.html#section5" >click me</a>
to link to a section/id of another page by
To navigate to a section of another page use:
<a href="example.html#example-section>name-of-link</a>
The example.html would be the page you want to go to, and the #example-section would be the name of the id on that page that you want to navigate to.
To link from a page to another section of the page, I navigate through the page depending on the page's location to the other, at the URL bar, and add the #id. So what I mean;
This takes you #the_part_that_you_want at the page before
I tried the above answer - using page.html#ID_name it gave me a 404 page doesn't exist error.
Then instead of using .html, I simply put a slash / before the # and that worked fine. So my example on the sending page between the link tags looks like:
El Chorro
Just use / instead of .html.
To link from a page to another section just use
my first div