Facebook PixelCSS Navigation Bar | CSS Tutorial | CodeWithHarry

CSS Navigation Bar

For a better command of CSS, and to understand how Navbars work, let’s try creating the navbar of this website itself.

Navbar Image

First, we will create a <nav> element in HTML and then add the attributes to it. Later the CSS would be applied.

HTML for Navbar

Output:

HTML Output

Now let’s add CSS to change this navbar according to our desired output.

CSS for Navbar

Note: .Icon is the class that I added later in the first <a> tag to provide it with different styling than the other elements.

The output of this code would be identical to what we had as our reference.

CSS Output