Forum Moderators: not2easy

Message Too Old, No Replies

True 'width' in Internet Explorer

Want the text to 'overflow' in IE

         

JamieCon

6:43 pm on Apr 5, 2006 (gmt 0)

10+ Year Member



Is there a way of getting Internet Explorer to respect true 'Width' values in CSS? I know that it interprets width as 'min-width' but I could really, really do with an element having a fixed width!

Cheers in advance

Jamie

zackattack

8:54 am on Apr 6, 2006 (gmt 0)

10+ Year Member



HI JamieCon

IE will respect a fixed width, just not min-width or max-width

So - in terms of a fixed width, you can expect IE to render this width the same as any other browser:

#container {
width: 185px;
}

There is one main work around to take into consideration for IE5 (now small proportion of browser market) and that is the Box Model issue - in brief IE 5 incorrectly adds any padding to the overall width of #container making it the width you want plus the padding size, so if you apply

#container {
padding: 10px;
}
IE5 will add this to the 185px making it 205px (185px + 10px + 10px - padding has been applied to the top bottom left and right, therefore the left and right have 10px either side)

This is easy to work around either apply the padding to the elements inside:

#container p {
padding: 10px;
}

Or create an extra div inside and apply padding to this instead:

#container {
width: 185px;
}
#container .gutter {
padding: 10px;
}

<div id="container">
<div class="gutter">
<p>some content</p>
</div>
</div>

Does this answer your question..?

ZA