How to add a link to a section in the same page?

How to add a link to a section in the same page?

mpatsi
Shopify Partner
111 0 14

Greetings,

 

i want from a button when clicked to move down to a section in the page....in a html page i would add a `id` to link the section but now from the template a can't...does anyone knows how to do that?

 

When i click this button

Screenshot 2023-07-17 at 12.22.45.png

 

to navigate me down here in the form (this is at the end of the same page)

 

Screenshot 2023-07-17 at 12.22.55.png

Replies 2 (2)

osamafarooqi71
Shopify Partner
259 22 44

Hello @mpatsi , you need to add a tag with href attributed to the respective id where you want to navigate. Please find attached the code to do this.

<a href="#YOUR_FORM_DIV_ID" >Button text</a>

<div id="YOUR_FORM_DIV_ID">
//form down here
....
</div>

 

Regards,

Osama Farooqi

Shopify Theme Developer | Contact me | Hire expert
- Was my reply helpful? Click Like 🙂 to let me know | Buy Me Coffee
- Was your question answered? Mark this as Accepted Solution
rich16
Visitor
2 0 0

Hi Osama,

 

I'm trying to create an anchor link as you have shown here how to do, but I have very little knowledge of coding. Could you kindly give an example of the code above with the actual relevant text? For example, what would the above code look like if I wanted to insert an anchor link in the word "Shipping"  to scroll me down to the "Shipping" section on the same page?

 

I'd be very grateful for your help. Thank you

Rich