IE7忽略了我的最小宽度设置.我读到IE7支持min-width,只要你处于标准模式(不是怪癖).我指定了
<!DOCTYPE html>
Run Code Online (Sandbox Code Playgroud)
作为我的标题.标记有效. 我仍然无法让IE7受到尊重min-width.我该怎么办?
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>
Run Code Online (Sandbox Code Playgroud)
CSS
.ExpandName
{
min-width:25em;
}
Run Code Online (Sandbox Code Playgroud)
sam*_*one 11
啊是的......我刚才遇到过这个问题
看看这个链接
http://blog.throbs.net/2006/11/17/IE7+And+MinWidth+.aspx
基本上......你需要在JS中包含这个垫片来手动破解规则
以下是我处理它的方式
只需调用正文的函数onload即可
/*
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{
//??
}
}
}
}
Run Code Online (Sandbox Code Playgroud)
还有另一种方法可以做到这一点
* html div#division {
height: expression( this.scrollHeight < 334 ? "333px" : "auto" ); /* sets min-height for IE */
}
Run Code Online (Sandbox Code Playgroud)
| 归档时间: |
|
| 查看次数: |
17734 次 |
| 最近记录: |