Buttons and navigation menu

Hello I am creating a website, and for the home page there are buttons to lead to other pages using the tag. I’m having a difficult time making it so that when you click a button it goes to the corresponding web page. All of the webpages are html documents saved in the same folder.

Are these html button elements or anchors (a elements)?

Only a elements will navigate to another page naturally.

<a href ="https://www.google.com/">Go To Google</a>

Maybe if you posted some of the code you are testing we can give more specific help :slight_smile:

1 Like

Here is some of the code. I want each of the buttons to lead to a web page.

            <button id="About" class="btn-1">About</button>
            <button id="Locations" class="btn-2">Locations</button>
            <button id="Gallery" class="btn-3">Gallery</button>
            <button id="FAQ" class="btn-4">FAQ</button>
            <button id="Contact Us" class="btn-5">Contact Us</button>          
        <script type="text/javascript">
            document.getElementbyId("About").onclick = function () {
                href = "about.html";

I actually found the solution already

Please don’t do that use anchors as I suggested in my first post. That’s what they were designed for and have accessibility baked in.

You can style them to look like buttons if you want.

Buttons are for dynamic actions requiring js or form submissions to work.

Anchors are for linking to pages and just work :slight_smile: