This forum is now read-only. Please use our new forums! Go to forums
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
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..
- Put both of your html files in a folder.
- 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.
Answer 55ad73b776b8fe1f1b0000c7
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>
Popular free courses
- Free Course
Learn SQL
In this SQL course, you'll learn how to manage large datasets and analyze real data using the standard data management language.Beginner friendly,4 LessonsLanguage Fluency - Free Course
Learn JavaScript
Learn how to use JavaScript — a powerful and flexible programming language for adding website interactivity.Beginner friendly,11 LessonsLanguage Fluency - Free Course
Learn HTML
Start at the beginning by learning HTML basics — an important foundation for building and editing web pages.Beginner friendly,6 LessonsLanguage Fluency