Nav Bar questions regarding top margin

I am practicing my navbar skills and I´m unsure what I´m doing wrong.

I want to have a navbar at the top of the screen with no gap.

My navbar has a gap and I´ve applied 0 value for the margin. I´ve still got a gap. Help, please.

Link below to my CodePen below where it´s located:
Link

if you put your mouse over the navbar and right-click, then choose “Inspect” you can review the styling that is being applied ‘live’ by the browser and identify the reason for the gap.

For eg. I can see that your element is enclosed in the body. And that the body has a margin. If i set margin-top for the body to 0, then everything gets pulled up.

1 Like

Looks like the margin on side + top is coming from the body element. ctrl+shift+i will get you to inspector in most modern browsers. within inspector, there is an arrow icon in the upper left bar when the panel opens up and that selector will let you choose elements on the page to see info about their styling, etc.

There are a few ways to change what you want, the easiest would be to declare 0units on the body but there are often unintended consequences for changing styling across all elements within the body

1 Like

This topic was automatically closed 182 days after the last reply. New replies are no longer allowed.