How to Create: Split Navigation

Learn how to use CSS to create a split navigation bar.

Split Navigation

Try It Yourself

Create a split navigation bar

Step 1 - Add HTML:

<div class="topnav">
  <a href="#home">Home</a>
  <a href="#news">News</a>
  <a href="#contact">Contact</a>
  <a href="#about" class="split">Help</a>
</div>

Step 2 - Add CSS:

/* Create a top navigation bar with a black background */
.topnav {
  background-color: #333;
  overflow: hidden;
}
/* Set the style of the links in the navigation bar */
.topnav a {
  float: left;
  color: #f2f2f2;
  text-align: center;
  padding: 14px 16px;
  text-decoration: none;
  font-size: 17px;
}
/* Change the color of the link when the mouse hovers over it */
.topnav a:hover {
  background-color: #ddd;
  color: black;
}
/* Create a right-aligned (split) link within the navigation bar */
.topnav a.split {
  float: right;
  background-color: #04AA6D;
  color: white;
}

Try It Yourself

Related Page

Tutorial:How to create responsive top navigation

Tutorial:CSS navigation bar