views:

124

answers:

9

Hi there,

I am coding exclusive ie6 css, wherein I am facing the problem. The footer does not take the min-width value whereas it accepts the fixed width value. I am using the repeat-x for an image and assigning a min-width value to it. The same thing I did with header div and it works perfectly fine. For example here is my code.

Header HTML which I have used for the same purpose.

<div id="header">
<!-- top-menu -->
    <div id="top-menu">
        <div id="left-logo">
        <a href="#"><img src="img/logo-left.png" alt="BhatkalNews" /></a>
        </div>
        <div id="navigation">
        <ul>
        <li class="contact"><a href="#"><img src="img/contact.png" alt="contact" /></a></li>
        <li class="photo"><a href="#"><img src="img/photo.png" alt="photo"/></a></li>
        <li class="video"><a href="#"><img src="img/video.png" alt="video" /></a></li>
        </ul>
        </div>
        <div id="right-logo">
        <a href="#"><img src="img/logo-right.png" alt="BhatkalNews" /></a>
        </div>
    </div>
</div>

And here is the css I have used.

#header {
    min-width: 1040px;
    height: 111px;
    background: url('../img/header-bg.jpg') repeat-x;
}

and for the same purpose the footer code is.

<div id="footer">
</div>

and the css

#footer {
    min-width:1040px;
    background:#36240A url('../img/footer.jpg') repeat-x;
    height:291px;
}

Why isn't footer assigning the min-width?

+2  A: 

Unfortunately min-width simply doesn't work in IE6. There's some javascript based hacks that you can try though if you absolutely need to use min-width.

Munzilla
if that is the case then how come it works for header, i tested using many tools for ie6.
Ibrahim Azhar Armar
min-width is not supported by IE6. What you're seeing is probably the fact that DIVs are block-level elements and so by default are 100% width.
Stephen Orr
+5  A: 

IE6(not even 7) does not support min-width.

try expresssions like

width: expression( document.body.clientWidth < 1040 ? "1040px" : "auto" );
Vinay B R
expressions are devil slow.
Stephen
@Stephen - your workaround uses Expressions :)
Vinay B R
Also I just noticed your expression sets a "max width" not a "min width"
Stephen
@Stephen: I agree with Vinay, the link you provided has a style with an expression in the IE6 only block. It then uses javascript for when you resize, etc.
Chris
Yes. It does. I stand corrected, and apologize!
Stephen
+1 for the solution that best fits the problem (designing only for ie6). But you should fix the solution! It still sets a max width.
Stephen
+1  A: 

min-width and max-width are not supported by ie6.

Here is a workaround that I found with a quick google.

Though I haven't tested it, it seems to be sound.

Stephen
+1 for the workaround
Ryan Kinal
+5  A: 

Min-width doesn't work with IE6 - no surprises there as IE6 is terrible.

There are some workarounds, here is one:

{width:90%; min-width:1040px}

Basically, use width with a percentage - you'll have to experiment on the percentage depending on what you are trying to achieve.

Joe R
+1 for the workaround
Ryan Kinal
+1  A: 

This only works in IE:

#footer{
    width:expression
        (document.body.clientWidth < 1040? "1040px": "auto")
}
revaxarts
it ain't working do i have to wrap it with script tag?
Ibrahim Azhar Armar
@Ibrahim Stop using "ain't" when you mean "isn't". "ain't" isn't a word.
meagar
A: 

Try _width: 1040px; along with min-width: 1040px;

lofto
IE 6 does not support min-width, but it treats width a lot like min-width. your answer uses a trick that IE6 ignores leading underscores, thus feeding a width to IE, which is ignored by other browsers.
Sean McMillan
A: 

well to be frank none of the solution worked satisfactorily for me. and after doing a workaround i came up with this solution.

<div id="footer">
    <div id="footer-content">
    </div>
</div>

i defined the footer. and wrapped footer-content inside it and assigned width of 990px as i wanted the content to be wrapped within 940px i gave a padding of 50px; to the left. here is the css i used.

/*footer*/
#footer {
    height: 291px;
    background: url('../img/footer.jpg') repeat-x;
}
#footer-content {
    margin:0 auto!important;
    width: 990px;
    height:291px;
    padding-left:50px;
} 

this works perfectly fine for me and the div's positions perfectly fine even if i am resizing. thank you for all the help guys. :)

Ibrahim Azhar Armar
A: 

Since you're coding exclusively for IE6, it be much more simple just to use:

width: 1040px;

IE6 doesn't recognize min-width, but treats width incorrectly, as if it was min-width.

(If it's not exclusively for IE6, you can use a hack, like the _width they already suggested you... or, even better, use conditional comments).

Laz75
A: 

I've explained how to use min-width or min-height in IE6 over here: http://stackoverflow.com/questions/3802455/min-width-in-window-resizing/3802670#3802670

DanMan