CSS margin problem with IE - Postet den (2698 Views)
Starting Member
Adjunkten
Innlegg: 30
30
I have site integrated my forum but body margins won't work in IE7. It looks fine in Firefox and Opera.
My body-CSS:

body { max-width: 1000px;
min-width: 800px;
margin: 0 auto;}

I suspect the tablecode is causing the problem, since margins are OK on pages outside my forum folder. I tried to "css" the table without succes. Do you know the trick?
http://www.adjunkten.dk/forum/default.asp
<moved from="Help: General / Current Version (v3.4.xx)" by="Shaggy" /><
   
 Sidestørrelse 
Postet den
Retired Support Moderator
MarcelG
Innlegg: 2625
2625
Max-width and Min-width are not supported in IE afaik. I've worked around this by using an expression:

Code:
.maxw {
margin-left: auto;
margin-right: auto;
max-width:1000px;
width:expression(document.body.clientWidth > 1000? "1000px": "auto" );
visibility: visible;
text-align: center;}
I'm not sure what the min-width replacement should be, as the code I use only does something with the max-width, but it'll give you an idea to start off with.<
Postet den
Starting Member
Adjunkten
Innlegg: 30
30
Thankyou, but it doesn't work. Your code is in my css now.
<
Postet den
Forum Admin
HuwR
Innlegg: 20611
20611
ok, strictly speaking you should not be assigning width attributes to the body tag, add a page container div and size that instead. it does not make sense to size the body tag since the body tag corresponds to the browser window.<
Postet den
Retired Support Moderator
MarcelG
Innlegg: 2625
2625
Oops, that's right ; in my CSS the above CSS style is not assigned to body, but to a div called maxw. I've put all content in that div. Reference: http://oxle.com/uploaded/screen.css<
Postet den
Forum Admin
HuwR
Innlegg: 20611
20611
also to set a min-width that works in IE6 and below, use the following.
.maxw {
margin-left: auto;
margin-right: auto;
width:auto !important;
width:800px;
max-width:1000px;
width:expression(document.body.clientWidth > 1000? "1000px": "auto" );
visibility: visible;
text-align: center;}

that will use auto for the width in FF/IE7 and 800px for the width in IE6 (width in IE6 is allways it's min-width)

also, IE6 does not support margin-auto so you need to do the following
body {text-align: center}
.maxw {
margin-left: auto;
margin-right: auto;
width:auto !important;
width:800px;
max-width:1000px;
width:expression(document.body.clientWidth > 1000? "1000px": "auto" );
visibility: visible;
text-align: left;}<
Postet den
Starting Member
Adjunkten
Innlegg: 30
30
Thankyou for your time.
I added a .container with the width specs to the css and added "<div class="container">" in the top of my inc_site_header.

IE still stretches width to fit screen size, which looks stupid on widescreen . blush
<
Postet den
Forum Admin
HuwR
Innlegg: 20611
20611
what version of IE are you using, I know this works in IE as I use it all the time, so there must be something wrong in your page<
Postet den
Starting Member
Adjunkten
Innlegg: 30
30
Originally posted by HuwR
also to set a min-width that works in IE6 and below, use the following.
.maxw {
margin-left: auto;
margin-right: auto;
width:auto !important;
width:800px;
max-width:1000px;
width:expression(document.body.clientWidth > 1000? "1000px": "auto" );
visibility: visible;
text-align: center;}

that will use auto for the width in FF/IE7 and 800px for the width in IE6 (width in IE6 is allways it's min-width)


Tried that too in .container. Only resizes topbar.
Maybe I have to consider another design, and this time start with IE. GRRR.<
Postet den
Starting Member
Adjunkten
Innlegg: 30
30
Huwr, I use IE7, vers. 7.0.5730.13.
What I don't understand is the difference between FF and IE. Doesn't IE7 respect W3C standards?<
Postet den
Forum Admin
HuwR
Innlegg: 20611
20611
what do you mean by it only sizes the topbar? this would indicate you haven't put the closing div tag in the correct place maybe<
Du må legge inn en melding