PDA

Click to See Complete Forum and Search --> : negative margin browser bugs


tZ
08-25-2006, 08:56 AM
I'm not certain so I'm just going to ask you more expierienced web gurus if there are any browser bugs for negative margins.

Since, I have created a two column layout and placed a negative margin on content div to get it to "float" to the right of my navigation div.

Si this is a basic skeleton of the html so you get the idea:


<body>
<div id="wrapper"</div>
<div id="navigation"></div>
<div id="content"></div>
</div>
</body>


Then I set a width and height for navigation and gave content a left-margin of the same. So that content sits to the right of navigation. However, at this point content is below navigation to the right. So what I did was set a negative top margin to make up the difference. Are there any browser inconsistencies I should be aware of using this method?

The_Black_Knight
08-25-2006, 12:21 PM
I can't say for sure (since I'm far from being a web guru), but could this article (http://www.alistapart.com/articles/negativemargins) be of any help?

EC
08-25-2006, 12:47 PM
geez I hope not, I love me some negative margins.

chris_bcn
08-25-2006, 02:56 PM
very handy things negative margins - I would say that they are a touch more fragile though.

I haven't had any coffee yet this morning, so bear with me. I'm not sure why you're using negative margins rather than floats here. The only reason I ever use negative margins is if the content absolutely HAS TO come before the navigation in the source code. I would appear that your content div is after the nav.

I think you would save yourself a lot of headaches to just use floats.

Then again I may be missing something. Caffeine has now arrived though

Benjamin
08-28-2006, 12:51 PM
I agree with chris, my first thought would be to use floats. If your navigation <div> is always shorter than your content, another option is to leave a large left margin on the content and use absolute positioning for the navigation.