-
1. Re: Good way to give navbar top margin?
John Waller Apr 10, 2011 3:33 PM (in response to Andy Bay)I have a navigation bar inside my wrapper div. I would like to give the navigation bar some top margin to push it down say 10 px from the top of the wrapper div.
Use margin-top.I don't see it anywhere in what you've posted.
But the top margin is not working like I would expect.
Can you upload a problem page and post a link so we can see it in our browsers?
-
2. Re: Good way to give navbar top margin?
Andy Bay Apr 11, 2011 12:29 AM (in response to John Waller)Hi!
When I try to use top margin, it also pushes the wrapper down from the top of the browser. But I need to move only the navbar down. Here is an uploaded example of the problem:
http://geminoidi.com/margin_test.html
Such a simple thing, but I can't seem to get it right. :S
-
3. Re: Good way to give navbar top margin?
osgood_ Apr 11, 2011 12:48 AM (in response to Andy Bay)Add padding top 1px to your wrapper css selector (as shown below)
#wrapper {
background-color: #000066;
min-height: 600px;
padding-top: 1px;
}Then make the top margin on your 'navbar' 19px if you want it to be 20px in total from the top of the browser window.
What is happening is the margin is collapsing and the wrapper is inheriting the style so you need to create a barrier between the two, the 1px padding does this.
Css works in mysterious and not always seemingly logical way.
-
4. Re: Good way to give navbar top margin?
Andy Bay Apr 11, 2011 1:00 AM (in response to osgood_)Cool -that did the trick! Thank you!



