Welcome!

By registering with us, you'll be able to discuss, share and private message with other members of our community.

SignUp Now!
  • Guest, before posting your code please take these rules into consideration:
    • It is required to use our BBCode feature to display your code. While within the editor click < / > or >_ and place your code within the BB Code prompt. This helps others with finding a solution by making it easier to read and easier to copy.
    • You can also use markdown to share your code. When using markdown your code will be automatically converted to BBCode. For help with markdown check out the markdown guide.
    • Don't share a wall of code. All we want is the problem area, the code related to your issue.


    To learn more about how to use our BBCode feature, please click here.

    Thank you, Code Forum.

HTML & CSS how do i make separate pages for my html website accessible from my navbar

Liam Ferguson

Active Coder
I want to create different pages corresponding to the information on the nav bar that is accessible by clicking on the buttons. How is this achieved? Here is the code for the Nav Bar, additional information will be given on request.
HTML:
<meta name="viewport" content="width=device-width, initial-scale=1">
<link rel="stylesheet" href="https://cdnjs.cloudflare.com/ajax/libs/font-awesome/4.7.0/css/font-awesome.min.css">
<style>
body {font-family: Arial, Helvetica, sans-serif;}

.navbar {
  width: 100%;
  background-color: #555;
  overflow: auto;
}

.navbar a {
  float: left;
  padding: 12px;
  color: white;
  text-decoration: none;
  font-size: 17px;
}

.navbar a:hover {
  background-color: #000;
}

.active {
  background-color: #4CAF50;
}

@media screen and (max-width: 500px) {
  .navbar a {
    float: none;
    display: block;
  }
}
</style>
<body>

<div class="navbar">
  <a class="active" href="#Home"><i class="fa fa-fw fa-home"></i> Home</a>
  <a href="#"><i class="fa fa-fw fa-search"></i> search</a>
  <a href="#"><i class="fa fa-fw fa-envelope"></i> Contact</a>
  <a href="#"><i class="fa fa-fw fa-user"></i> More Info</a>
</div>

</body>
 
For example: this line <a href="#"><i class="fa fa-fw fa-search"></i> search</a> - you'd change the text that href refers to like this: <a href="search.html"><i class="fa fa-fw fa-search"></i> search</a>. This will refer to a file search.html in the same folder as the location of the file containing the navbar.
 
For example: this line <a href="#"><i class="fa fa-fw fa-search"></i> search</a> - you'd change the text that href refers to like this: <a href="search.html"><i class="fa fa-fw fa-search"></i> search</a>. This will refer to a file search.html in the same folder as the location of the file containing the navbar.
Just like @Krusty the Senile mentioned. <a href="pathtofile">Your page</a>. Your path is where ever your webpage file is, you can also link other websites by using an URL within the href quotes.

Have a look at https://developer.mozilla.org/en-US/docs/Web/HTML/Element/a
 

New Threads

Latest posts

Buy us a coffee!

Back
Top Bottom