Log in

View Full Version : Resolved content alignment with fixed div above



traq
10-16-2008, 01:59 AM
I figured it out. Almost all of my problems were being caused by a typo in the content-type meta tag. thanks for the help.

Page in Question (www.custom-anything.com/reel/)

I've got a page with a div fixed at the top of the window (contains the site menu) and a content div below it. the whole thing is centered.

Problem: when I use:

#content{
margin: 0 auto;
text-align: center;
width: 700px;
padding: 0;
}
it works fine in IE, but in FF, the content goes to the top of the page, behind the menu div.

When I use:

#content{
margin: 0 auto;
text-align: center;
width: 700px;
padding: 0;
position: absolute;
top: 200px;
left: auto;
right: auto;
}
it's fine in FF but in IE, the content is pushed partway off the right side of the screen.

I've tried several other positioning, padding, margin, etc. combinations, but I can't seem to solve both browsers' problems at once. Any suggestions? Thanks, everyone.

TheJoshMan
10-16-2008, 02:58 AM
then use this one in your stylesheet...



#content{
margin: 0 auto;
text-align: center;
width: 700px;
padding: 0;
position: absolute;
top: 200px;
}


then put this in the <head> of your page in question...



<!--[if IE]>
<style type="text/css">
#content{
margin: 0 auto;
text-align: center;
width: 700px;
padding: 0;
position: absolute;
top: 200px;
}
</style>
<![endif]-->

traq
10-16-2008, 04:16 AM
I assume you mean

<!--[if IE]>
<style type="text/css">
#content{
margin: 0 auto;
text-align: center;
width: 700px;
padding: 0;
}
</style>
<![endif]-->
(which works in IE) in the head of the page and

#content{
margin: 0 auto;
text-align: center;
width: 700px;
padding: 0;
position: absolute;
top: 200px;
left: auto;
right: auto;
}
(which works in FF) in the stylesheet? Tried it, but it doesn't work. I also tried it exactly how you posted (just in case), but no go either. Any other ideas?

Another odd thing that just popped up is that the drop-down submenus are now transparent in IE, but not in FF.