Ask Your Question

Revision history [back]

click to hide/show revision 1
initial version

There are different methods to place the navigation bar at the top of an HTML page, but the most common way is to use HTML and CSS. Here's an example:

HTML:

<header>
  <nav>
    <ul>
      <li><a href="#">Home</a></li>
      <li><a href="#">About</a></li>
      <li><a href="#">Services</a></li>
      <li><a href="#">Contact</a></li>
    </ul>
  </nav>
</header>

CSS:

header {
  background-color: #333;
  color: #fff;
  padding: 10px;
}

nav {
  display: flex;
  justify-content: space-between;
  align-items: center;
}

ul {
  display: flex;
  list-style: none;
  margin: 0;
  padding: 0;
}

li {
  margin-left: 20px;
}

a {
  color: #fff;
  text-decoration: none;
}

In this example, we're using a <header> element to wrap the navigation bar, and inside it, we have a <nav> element with an unordered list <ul> of navigation links. We're using CSS to style the header and navigation, including setting the background color, aligning the links, and removing any default list styles.

Note that this is just one example - there are many ways to style and structure a navigation bar in HTML and CSS.