0

I am creating a portfolio website for practice purpose.

index.html :

enter image description here

work.html :

enter image description here

In index.html, the three sections at bottom are images. On clicking either one, it redirects to work.html In work.html , the three sections have separate ids as #website-container, #ui_ux-container & #business_cards-container. And the line is a normal <hr> tag.

My question is, since work.html will be a long page, how can I redirect to a particular section from one page to another ?

I tried doing :

<a target="#website-container" href="work.html"> <img src="websites.png"> </a>

but this opened the work.html on a separate tab. how can I make it open in same tab and in that particular section ?

Pete
  • 57,112
  • 28
  • 117
  • 166
Aman Devrath
  • 398
  • 1
  • 3
  • 21
  • put the target on the end of the url (if there is an id with matching the hash, then it will jump straight to that section) – Pete Apr 15 '19 at 11:07

2 Answers2

1

if i get you right, you just have to change your code to

<a href="work.html#website-container">
    <img src="websites.png">
</a>

so its an link with an anchor (directly after the "normal" url 'e.g. your-url.html#anchor')... if the ID is set correctly you'll directly jump to that position

FalcoB
  • 1,333
  • 10
  • 25
0

Href should be work.html#website-container remove target

Alex
  • 23
  • 2
  • 8