javascript – Anchor <a> tag doesn't navigate to the bottom of the page in Safari iOS-ThrowExceptions

Exception or error:

I have a tag with id in href:

<a href="#contact-us">Contact Us </a>

and form in the bottom of the page:

<section id="contact-us">
  <form />

When I click on it, anchor takes me to the bottom of the page to the contact form. This works fine in Chrome, FF but not on Safari.
For some reason, it takes me to the top of the page.
How can I fix this issue on Safari or it is bug in Safari itself?

How to solve:

As volt mentioned above, ensure that you are closing your section tag correctly, with </section> rather than <section />. In HTML, only void tags (tags which stand on their own and do not get closed by a companion tag) use a slash at the end of the tag rather than the beginning.


<br /> <!-- Void tag -->
<div>content</div> <!-- Non void tag -->

Leave a Reply

Your email address will not be published. Required fields are marked *