Why doesn't my Navbar span across the viewport?

I’m doing the Portfolio Project and trying to get my Navbar to span across the top of the window.

I gave the navbar the width of width: 100vw; but it’s not spanning across the viewport.

Also, any idea why my ul is not centered in the Navbar? It seems to be on the right side of my Navbar.

Here’s my pen:

https://codepen.io/El_Escandalo/pen/pozqbaQ?editors=1100

Hi,
your navbar is spanning across the window correctly. Maybe you want to add a background color to nav element instead of the ul.

<ul> and some other elements have the default styling that a browser adds to the element like margin and padding.

You could reset all paddings and margins from elements by adding at the beginning of your CSS file

* {
  margin: 0;
  padding: 0;
} 

or set padding: 0; and margin: 0; to the ul element only

1 Like