Search code examples
htmlonclickgoto

Go to div on page when i click on a buttom


I Want my buttom to take the use to a serten place on the page. i was looking at some jquery but i would prefer to do it in HTML5 and css3 if it works. I also took a look at anchor tags but didnt get it to work with mu button. <button type="button" class="btn" >Contact-us</button> and my page i want to go to <div id="contact-us">


Solution

  • In your div, or right above it you can use a link like such:

    <a name="label"></a>
    

    Later you can link to it with

    <a href = yoururl#label">Click here</a>
    

    This type of link is called an anchor, and will not be visible.