Skip to Content
0 points
Submitted by Corbin Smith
almost 6 years

How do I link two HTML pages with a button?

I’ve got two HTML pages, with one being an opening page for an application and the second being a login page. I have a button on the opening page and I want to be able to click on it and have it take me to the login page. How do I do this?

Answer 55ad66fe9113cb01770002df

0 votes

Permalink

I believe you would be wanting:

<a href="login.html"><button>Go To Login</button></a>

However I don’t believe this method works in your code academy browser/workspace.

If you can not do that then you can try a form:

`

`

If these don’t work I would suggest setting up a work-space on your computer. (a local environment)

To do this..

  1. Put both of your html files in a folder.
  2. Drag your opening html page into a blank tab on your browser

If you do that the link buttons should definitely work.

And make sure the <a href= points to your other html file you want to go to.

1705 points
Submitted by Devin Miller
almost 6 years

Answer 55ad73b776b8fe1f1b0000c7

0 votes

Permalink

Using a <div></div> element with set dimensions we then insert a link inside the element:

<div id="button"><a href="login.html">Log In</a></div>

The CSS might look like this (add style element to HEAD section of page (I’m using lesson 14 as a sandbox):

<style>
#button {
    width: 6em;
    border: 2px solid green;
    background: #ffe;
    border-radius: 5px;
}
a {
    display: block;
    width: 100%;
    line-height: 2em;
    text-align: center;
    text-decoration: none;
    border-radius: 5px;
}
a:hover {
    color: red;
    background: #eff;
}
</style>
9560 points
Submitted by Roy
almost 6 years