How TO - Split Navigation
Learn how to create a "split navigation" bar with CSS.
Split Navigation
Create A Split Navigation Bar
Step 1) Add HTML:
Example
<divw3-example">
Example
/* Create a top navigation bar with a black background color */
.topnav {
background-color: #333;
overflow: hidden;
}
/* Style the links inside 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 links on hover */
.topnav a:hover {
background-color: #ddd;
color: black;
}
/* Create a right-aligned (split) link inside the navigation bar */
.topnav a.split {
float: right;
background-color: #04AA6D;
color: white;
}
Try it Yourself ».topnav {
background-color: #333;
overflow: hidden;
}
/* Style the links inside 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 links on hover */
.topnav a:hover {
background-color: #ddd;
color: black;
}
/* Create a right-aligned (split) link inside the navigation bar */
.topnav a.split {
float: right;
background-color: #04AA6D;
color: white;
}
Tip: To create mobile-friendly, responsive navigation bars, read ourHow To - Responsive Top Navigation tutorial.
Tip: Go to ourCSS Navbar Tutorial to learn more about navigation bars.
Ever heard aboutW3Schools Spaces? Here you can create your website from scratch or use a template.
Get started for free ❯* no credit card required

