Expanding Box Problem
Problem
Any content that does not fit in a fixed-width or -height box causes the box to expand to fit the content. (The content should overflow instead.)
Solution
Use word-wrap: break-word inside IE-conditional comments (works on text only) or overflow: hidden (works on all content, but may cause content to be clipped).
Detailed description
This is one of the more problematic bugs in Internet Explorer 6 and earlier (Windows) because it causes other bugs, such as Float Drop. A frequent cause of the box expansion problem is long, unbroken strings like raw URLs: the text has no natural break to wrap the line, so it extends beyond the defined width of the box--and pushes the box out in the process. Images that are too wide for their containers can also cause those containers to expand.
Solutions
The first and easiest solution is to specify a width for your container that is wide enough to accommodate all of your content. When this isn't possible, two other options are available:
- For long text, such as URLs, you can force a break in IE by specifying word-wrap: break-word; on the container. Note that word-wrap is a proprietary Microsoft property that is not part of any CSS spec; you should enclose this property in IE conditional comments if you want your CSS to validate.
- For all other content, you can prevent expansion by applying overflow: hidden to the container. This will cause any content that would otherwise cause the container to expand to be clipped instead.
NOTE: Boxes with no specific width also expand; in this case, the overflow: hidden workaround does not apply. If the expansion is desirable, the same effect can be achieved in standards-compliant browsers by applying display: table-cell to the container.
Bug originally documented on positioniseverything.net by Artcoder. (
Read original article)
Text ID:
EXPANDING_BOX_PROBLEM
Comments ()
To add a comment, please
Log in.
Expanding Box Problem In site
by BHOOBALA KRISHNAN B on October 5, 2009
Thanks a lot... for the solution.. its worked for me... i hate ie browsers they have many css bugs... better to drop the ie6 and ie7 browsers..
Expanding box problem IE 7 spry horz. menu
by bcosgrove@cmts.com on September 25, 2009
I've read all the comments and tried many of them. Still my menu drop downs shift around and even show up off the far side of the page. I'm using auto widths still and have some long titles to deal with. Of course everything looks great in FF mac/win, Safari, and Chrome. Do I need to use fixed widths? Sigh.
Expanding box problem
by webaviso1 on September 2, 2009
I am just embarking on the whole CS4 Suite for the first time.
I am encounteruing this expanding box problem in Dreamweaver with a beginners template that I had downloaded to work on. Also notably though - this issue seems to affects all browsers ... help !!
Expanding Box Problem with Photoshop's web gallery
by dlb54 on April 16, 2009
I'm getting the expanding box problem notice and it's associated with photoshop's web gallery that I've got in my website. Any way to make this work? I have IE 6 but did notice that it will work at school on IE 7. But....not everybody who might view this page will have IE 7.
:-*
by Pulikuttie on March 24, 2009
Thanks a lot man!!!!!!!!!!!!!!!!!! Saved a lot time.... Love u Adobe!!!!!!!!!!!!!!
This problem also seems to affect IE7
by DariaLee on December 29, 2008
I used this technique to fix a layout that was acting crazy in IE7 but was perfectly fine in Safari, FF mac, and FF windows.
For those of you who don't know how to do conditional comments, here's what I did, step x step:
1) I created a separate stylesheet named IE7.css and put it in a directory called _css.
2) Put the rules above in my IE7.css file like this:
div.container {
overflow:hidden;
word-wrap: break-word;
}
3) Created a conditional comment in the header of my html page like this:
<!--[if IE 7]>
<link href="_css/IE7.css" rel="stylesheet" type="text/css">
<![endif]-->
The conditional comment tells IE7 to use the styles in the IE7.css stylesheet. Other browsers ignore this stylesheet.
It might be helpful if this post was updated to note that this bug affects IE7 too.
expanding box problem
by Mxuser22 on June 2, 2008
I think I have the same problem. I have my resolution set at 1280x768, but when i change it to 800x600 or 1024x768, the content overflows in the white area, in ff and ie 6 and 7. I added overflow: hidden; but that didn't have any effect, I have fixed wdith on all containers. I have cc and added the body {word-wrap: break-word;}, Here's my link: any help would be greatly appreciated http://www.myhealthsolution.net/index-daisy-4k.html
Spry Drop Down Issue
by antonio_rzr on April 21, 2008
I tried to use the Drop Down for Spry and am having problems viewing in Internet Explorer. But I can view it fine in Firefox. Can someone please help me on this? I have the HTML code pasted here for one of the menu drop downs. For e.g., Under Home I have (About Us and Contact Us)
<body>
<table width="1193" border="0" cellpadding="0" cellspacing="0" background="images/Background/sky_blue1-1194x1202.jpg">
<!--DWLayoutTable-->
<tr>
<td height="252" colspan="4" valign="top"><table width="100%" order="0" cellpadding="0" cellspacing="0">
<!--DWLayoutTable-->
<tr>
<td width="900" height="67" valign="top">
<div id="mainnavigation">
<form id="form1" name="form1" method="post" action="">
<label class="form"></label>
<div id="navigation">
<ul id="MainMenu" class="MenuBarHorizontal">
<li><a class="MenuBarItemSubmenu" href="index.html">Home</a>
<ul>
<li><a href="aboutus.html">About Us</a></li>
<li><a href="contactus.html">Contact Us</a></li>
</ul>
</li>
</div>
</form>
</div>
Spry drop down issue
by SOMK on April 21, 2008
Me insert drop down spry menu into page, internet explorer 6 no work drop down, me search internet for problem, me no find answer that speak in language me understand. Me want to know how make spry menu work good in internet explorer six? Me try overflow:hidden, no work.
Me give code sample:
"<ul id="MenuBar1" class="MenuBarHorizontal">
<li>
<div align="center"><a href="#" class="MenuBarItemSubmenu"><strong>Online Only</strong></a>
<ul>
<li><a href="http://www.recirca.com:8980/konakart/Welcome.do" target="_blank">Shop</a></li>
<li><a href="/onshow/index.shtml">Listings</a></li>
<li><a href="/artnews/index.shtml">News</a></li>
<li><a href="/feedback/index.shtml">Feedback/Polls</a></li>
<li><a href="/reviews/index.shtml">Reviews</a></li>
<li><a href="/articles/index.shtml">Articles</a></li>
<li><a href="/online_projects/index.shtml">Projects</a></li>
<li><a href="/adverts/index_online.shtml ">Advertising</a></li>
<li><a href="/submissions/submissions_online.shtml">Submissions</a></li>
</ul>
</div>
</li>
<li>
<div align="center"><a href="#" class="MenuBarItemSubmenu"><strong>Magazine</strong></a>
<ul>
<li><a href="/currentissue.shtml">Current Issue</a></li>... etc
...<div align="center"><a href="#" class="MenuBarItemSubmenu"><strong>About</strong></a>
<ul>
<li><a href="/about/index.shtml">Structure of Circa</a></li>
<li><a href="/contact/index.shtml">Contact Circa</a></li>
</ul>
</div>
</li>
<li>
<div align="center"><a href="http://www.recirca.com/index.shtml"><strong>Home</strong></a></div>
</li>
</ul>"
If you can explain good me give big reward me have daughter make good wife can hunt good, snap giraffe neck with thighs.
Where do i put the conditional comments?
by johnnycoyote on April 9, 2008
"For long text, such as URLs, you can force a break in IE by specifying word-wrap: break-word; on the container. Note that word-wrap is a proprietary Microsoft property that is not part of any CSS spec; you should enclose this property in IE conditional comments if you want your CSS to validate."
I'm sorry for my ignorance, but where exactly do i have to put the conditional comment in the code? in the style of the div concerned (before/after.....)? or just after the div tag?
thanks for your help
DIV Tag Fix
by jrod4329 on March 31, 2008
This problem affected my WebSite for a few days, and I tried to work around it a few times with fixed table/cell/column widths, but to no success. I was parsing in an rss feed that kept expanding my cell to throw off the entire sites symmetry in IE7 while Firefox displayed a perfect site. DIV tags were the solution to my problem. Here is a quick version of my fix below:
Here is what it looked like with the cells taking the class input from the CSS:
<tr>
<td width="260" class="newsTable"><?php include("server2.php"); RenderRSS2(); ?></td>
</tr>
I encapsulated the cell contents inside a DIV tag with the CSS class I wanted and it fixed everything:
<td width="260" align="left"><div class="newsTable"><?php include("server2.php"); RenderRSS2(); ?></div></td>
DIVS FIX YOUR INTERNET EXPLORER PROBLEMS!!!!
What worked for me
by Vulcan07 on February 17, 2008
I found that the expanding box problem affected IE7. Unfortunately I wasn't able to get the the conditional comment workaround to work. Eventually I amended my html to introduce a singl-cell 'conditional table', as below, which worked fine.
<div class="CaptionText"><!--[if IE]><table> <td width="100%" lass="Caption"><![endif]-->Greetings!<br>
<br>
My Text Here<!--[if IE]</td>
</table><![endif]-->
Hope this helps
</div>
Re: I'm not clear on this
by LoriHC (Dreamweaver Team) on October 22, 2007
@rub-a-dub: It's impossible to say without seeing your code. The Expanding Box Bug does not affect table cells -- those *should* expand to fit their content. If the bug is being reported for a div inside a table cell, that's probably a case where we're being overzealous in detecting the bug in Dreamweaver. (I don't think it occurred to me to check if the affected box was inside a table cell; I only check whether the content's parent was a table cell, and ignored *that* case.)
If you're getting this error on a div inside a table cell, you can safely ignore it. Meanwhile, I'll log a bug that I need to update the detection to check for whether the affected box is inside a cell.
IE 7 too?
by nickelmusic on October 13, 2007
It seems to me that IE 7 has the same bug. All my previews using IE7 also expand to include any content that is too big.
I'm not clear on this
by rub-a-dub on October 12, 2007
I'm seeing this error (and can't find a way to turn off the message), but when I try the fixes above, I still see the error message. Maybe I'm reading this wrongly. By "box," I assume the text is referring to a table cell, and by "container," I assume the text is referring to something like a <div> tag inside the cell wrapping the contents of the cell?
Conditional Fix causes new problem
by Stevan2002 on October 1, 2007
I have applied the IE conditional fix which does fix the expanding box problem. However, another part of the page is affected by the fix. The page is a 3 column layout. The left column, where the IE fix was applied contains a flyout menu. The center main content is elastic. The right column, contains links from 2 include files. When the IE fix is applied to the left column, the right half of the text of the right column disappears. When you hover the mouse over the right colum, the text reappears.
When I remove the IE conditional fix from the left column, the right column displays correctly.
body {word-wrap: break-word;}
by Venkat Ganjipally on September 28, 2007
<!--[if IE]>
<style type="text/css">
body {word-wrap: break-word;}
</style>
<![endif]-->
THIS SCRIPT WILL EFFECTS IN: Firefox 1.5, 2.0; Internet Explorer for Macintosh 5.2; Netscape 8.0; Opera 8.0, 9.0; Safari 2.0
Expanding box conditional comment
by toloko on September 25, 2007
<!--[if IE]>
<style type="text/css">
body {word-wrap: break-word;}
</style>
<![endif]-->
Clarify "browsers I want to target"?
by LoriHC (Dreamweaver Team) on April 8, 2007
Hi dlplp - Can you be more specific about what you're looking for? This bug only affects Internet Explorer 6.0 and earlier on Windows, so the solutions only apply to those browsers as well. As long as you enclose either solution in an IECC, no other browsers will be affected at all.
OK - Solution
by dlplp on April 8, 2007
It was great to know my two options I had. Now, It would be great if it tell me
which one affects the browsers I want to target more..