|
马上注册,结交更多好友,享用更多功能,让你轻松玩转社区。
您需要 登录 才可以下载或查看,没有帐号?立即注册
x
ie中母div被设置成特定高度之后,假如里面的子div高度(有float的话就以清除float的div的最底为总高度)超过了母div设置的高度,ie会自动把母div撑大,但是ff却不能,ff中母div的高度会依然,里面的子层会溢出到外面来。兼容方法:不要设置母层高度
<!DOCTYPEhtmlPUBLIC"-//W3C//DTDXHTML1.0Transitional//EN""http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd"><htmlxmlns="http://www.w3.org/1999/xhtml"><HEAD><TITLE>随转动条挪动的层-www.ckuyun.com</TITLE><METAHTTP-EQUIV="Content-Type"CONTENT="text/html"charset="gb2312"></HEAD><style><!--.div{position:absolute;border:2pxsolidred;background-color:#EFEFEF;line-height:90px;font-size:12px;z-index:1000;}--></style><BODY><divid="Javascript.Div1"class="div"style="width:240px;height:90px"align="center">正中...</div><SCRIPTLANGUAGE="JavaScript">functionsc1(){document.getElementById("Javascript.Div1").style.top=(document.documentElement.scrollTop+(document.documentElement.clientHeight-document.getElementById("Javascript.Div1").offsetHeight)/2)+"px";document.getElementById("Javascript.Div1").style.left=(document.documentElement.scrollLeft+(document.documentElement.clientWidth-document.getElementById("Javascript.Div1").offsetWidth)/2)+"px";}</SCRIPT><divid="Javascript.Div2"class="div"style="width:240px;height:90px"align="center">左上...</div><SCRIPTLANGUAGE="JavaScript">functionsc2(){document.getElementById("Javascript.Div2").style.top=(document.documentElement.scrollTop)+"px";document.getElementById("Javascript.Div2").style.left=(document.documentElement.scrollLeft)+"px";}</SCRIPT><divid="Javascript.Div3"class="div"style="width:240px;height:90px"align="center">左下...</div><SCRIPTLANGUAGE="JavaScript">functionsc3(){document.getElementById("Javascript.Div3").style.top=(document.documentElement.scrollTop+document.documentElement.clientHeight-document.getElementById("Javascript.Div3").offsetHeight)+"px";document.getElementById("Javascript.Div3").style.left=(document.documentElement.scrollLeft)+"px";}</SCRIPT><divid="Javascript.Div4"class="div"style="width:240px;height:90px"align="center">右上...</div><SCRIPTLANGUAGE="JavaScript">functionsc4(){document.getElementById("Javascript.Div4").style.top=(document.documentElement.scrollTop)+"px";document.getElementById("Javascript.Div4").style.left=(document.documentElement.scrollLeft+document.documentElement.clientWidth-document.getElementById("Javascript.Div4").offsetWidth)+"px";}</SCRIPT><divid="Javascript.Div5"class="div"style="width:240px;height:90px"align="center">右下...</div><SCRIPTLANGUAGE="JavaScript">functionsc5(){document.getElementById("Javascript.Div5").style.top=(document.documentElement.scrollTop+document.documentElement.clientHeight-document.getElementById("Javascript.Div5").offsetHeight)+"px";document.getElementById("Javascript.Div5").style.left=(document.documentElement.scrollLeft+document.documentElement.clientWidth-document.getElementById("Javascript.Div5").offsetWidth)+"px";}</SCRIPT><SCRIPTLANGUAGE="JavaScript"><!--functionscall(){sc1();sc2();sc3();sc4();sc5();}window.onscroll=scall;window.onresize=scall;window.onload=scall;//--></SCRIPT><divstyle="position:absolute;top:0px;left:0px;width:10000px;height:4000px;"></div></BODY></HTML>
尺度之路www.ckuyun.com提醒:能够先修正部分代码后再运转
说实话,我并不是反对div+CSS,但物生一利,必生一弊,div+css的利处大家说了很多,我就说说狂热的追求div+css的几个弊端: |
|