IE7忽略了我的最小宽度设置。我读到IE7支持最小宽度,只要你处于标准模式(不是怪癖)。我指定
<!DOCTYPE html>
作为我的标题标记是valid.我仍然不能得到IE7尊重最小宽度。我该怎么办?
Sample Code <table class="ProcedureTable"> <thead> <tr> <th>column data</th> <th>column data</th> <th>column data</th> <th>column data</th> <th>column data</th> </tr> </thead> <tr class="PadColumns"> <td class="ExpandName"> column data </td>
CSS
.ExpandName { min-width:25em; }
解决方法
啊是的..我曾经遇到过这样的事情
看看这个链接
http://blog.throbs.net/2006/11/17/IE7+And+MinWidth+.aspx
基本上…您需要在JS中包含这个垫片来手动地将这个规则删除
下面是我处理它的方式
/* author: Rob Eberhardt desc: fix MinWidth for IE6 & IE7 params: none returns: nothing notes: cannot yet fix childless elements like INPUT or SELECT history: 2006-11-20 revised for standards-mode compatibility 2006-11-17 first version */ function fixMinWidthForIE(){ try{ if(!document.body.currentStyle){return} //IE only }catch(e){return} var elems=document.getElementsByTagName("*"); for(e=0; e<elems.length; e++){ var eCurStyle = elems[e].currentStyle; var l_minWidth = (eCurStyle.minWidth) ? eCurStyle.minWidth : eCurStyle.getAttribute("min-width"); //IE7 : IE6 if(l_minWidth && l_minWidth != 'auto'){ var shim = document.createElement("DIV"); shim.style.cssText = 'margin:0 !important; padding:0 !important; border:0 !important; line-height:0 !important; height:0 !important; BACKGROUND:RED;'; shim.style.width = l_minWidth; shim.appendChild(document.createElement(" ")); if(elems[e].canHaveChildren){ elems[e].appendChild(shim); }else{ //?? } } } }
还有另一种方法来做到这一点
* html div#division { height: expression( this.scrollHeight < 334 ? "333px" : "auto" ); /* sets min-height for IE */ }