Red Eye Photography Navigation Bar centering


#1

Hi there!

So, I noticed that the navigation menu will only get centered if I add padding to the ul, like so:
.nav ul {
text-align: center;
padding: 1px;
}

Otherwise, it'll be slightly skewed to the right. Can anyone explain me why this happens?


#2

Hi @javamaster78629,

Browsers give lists a bit of padding-left for when they're shown in a page of text, like this:

  • See how this list isn't
  • On the left edge?
  • Unlike text, which is

This makes it easier to read in a page of text, but when used as a navigation bar, like you noticed, it throws off the alignment.

You could set the list's padding to 0 as well, and that would also work :slight_smile:


#4

This topic is inactive.