How to go to another file in .html? + another question

I need to Know this information because i need to make a Log in and a register page for my new project
Local=world. Here is where i need it: <button> Login <!-- I need to go to folder Login.html here.--> </button> <button> register <!-- I need to go to folder Register.html here.--> </button>
I also have a team page:

Thanks for reading! bye!

1 Like

Oops, about the other question:
How do i make the code in these pages?
Thanks!

Hi and welcome @THE.WHAT :slight_smile:

I checked out your project, https://glitch.com/~local-world, and here’s what I found.

Your site is setup as a ‘static site’, that makes it easy for linking to other pages.

First let’s talk about what you’re linking to. It looks like you accidentally created a folder called ‘Homepage.html’ and nested some of your pages in there. I would drag them out of that folder so that they sit at the same level as index.html.

image

Then, usually the way to link to another page is with an a tag like:

<a href="Login.html">Login</a>

But I see you want buttons. You can style an a tag to look like a button, which would be the “right way” to do this.

In that case, you’d make a style something like

.btn { border: 1px solid gray; padding: 4px; }

and then change your tag to <a href="Login.html" class="btn">

Now…

You can do the following but it’s kind of non-standard:

<a href="Login.html>
  <button>Login</button>
</a>

Then there are some more exotic ways as described on this SO answer: html - Can I nest a <button> element inside an <a> using HTML5? - Stack Overflow

You also asked “How do i make the code in these pages?”

The answer is to open the corresponding file in the left nav bar (the one I pictured earlier) and put a load of HTML in there.

Just remember that at the moment, the address of your other pages is like https://local-world.glitch.me/Homepage.html/Login.html and you need to fix that first by removing the folder you added by mistake.

Have fun! Let us know how it goes!

@SteGriff has a good idea, however I have a different approach.

Make a folder for every new page, name it like you would the page, e.g. login/index.html register/index.html

This would allow you to just type /login or /register to reference the page.

As for how you would go to the page, my method is below

<a href="/login">Login</a>

Happy Coding!

This topic was automatically closed 180 days after the last reply. New replies are no longer allowed.