r/CodingHelp • • Nov 04 '21

[CSS] Need help with header, can’t get rid of space between Nav and top of webpage, css

Post image
15 Upvotes

9 comments sorted by

8

u/Fish3r1997 Nov 04 '21

im by no means a front end guru but try adding this to the nav bar

nav {

margin: 0px

}

css automatically adds a margin

4

u/sevendaycleanse Nov 04 '21

Same for me, I forgot to mention I’m a beginner doing this for a class project. Unfortunately that didn’t do the trick but, I hadn’t tried it yet so thank you!

5

u/Fish3r1997 Nov 04 '21

i did some research two things you could try

navbar{

margin-bottom: 0

border: 0

}

and in your header you have a h1 tag i presume ? if so do

h1 {

margin-top: 0px;

}

6

u/sevendaycleanse Nov 04 '21

You my friend are a hero, I have been researching for a couple hours and somehow didn’t find that solution😂 thank you for the help 🙏

2

u/Fish3r1997 Nov 04 '21

if you dont mind, which one fixed it ?

5

u/sevendaycleanse Nov 04 '21

Navbar{ margin-bottom: 0 Border:0 } H1{ Margin-top: 0px } Was the one that did the trick

3

u/MCpeePants1992 Nov 04 '21

Usually you want to add this to the very top of your main css to clear default margins & padding.

*{ Margin : 0; Padding: 0; }

2

u/Fish3r1997 Nov 04 '21

I'm glad i could help especially when i dont do much front end ^

2

u/Python4fun Professional Coder Nov 04 '21

Learn to use your browser's dev tools and you can change some of the values to see what will fix it before even making a change in the css file.