Hey guys, I’m taking up HTML/CSS for the first time in years and I’ve followed some good tutorials and I believe I have the basics down. I’ve plucked up the courage to begin my own project and so far I’ve ran into a snag with the top nav bar. I’ve created a div id of topbar, and I’ve set the colour and what not, however the bar does not reach the very top of the page. I’ve set padding and margin to 0 in both body and in my topbar but I’m having problems getting it to reach the top.
a child element of #topbar has top margin protruding out the top. you can do a number of things to fix the problem. 1) add overflow: hidden; to #topbar – this changes its block formatting context; 2) add a top padding or border to #topbar; 3) eliminate the top margin on the child element.
Watson90, using the universal selector to zero padding and margin is not a good idea.