当前位置: 首页 > 图文教程 > 网页制作 > HTML/XHTML教程 > 常见页面元素遮住菜单解决方法

HTML/XHTML教程
通过W3C XHTML1.0及CSS标准必须注意的九个问题
注意这11个问题保证CSS的渲染效率
用css+js定义input_file元素的样式来兼容FireFox
CSS技巧:如何使未知高宽的图片实现垂直居中
CSS基础教程:布局网页技巧的完全学习手册
css知识:Div和Span在使用中的不同之处
css技巧:批量保存div+css网页中的图片的几种方法
CSS技巧:常用的属性代码简化表
介绍二款b/s开发中常用小工具
css教程:IE6、IE7和FF的hack的运用技巧
Google改进SSL机制,控制SSL安全机制存漏洞
css技巧:分享9个网页制作常用技巧
规范Web站点设计css类以及id的命名方式
html教程:WEB标准从头开始_DOCTYPE声明
html/css教程:背景图片的定位问题详解
CSS教程:自动隐藏网页文字的技巧
汇总一些IE与Firefox的CSS兼容问题及解决办法
网页中利用Title属性的好处
40多个漂亮的网页表单设计实例
制作商业HTML邮件的建议

HTML/XHTML教程 中的 常见页面元素遮住菜单解决方法


出处:互联网   整理: 软晨网(RuanChen.com)   发布: 2009-11-04   浏览: 49 ::
收藏到网摘: n/a

1.被挡住
设置Flash的参数:<param name="wmode" value="opaque">
<object classid="clsid:D27CDB6E-AE6D-11cf-96B8-444553540000" codebase="http://download.macromedia.com/pub/shockwave/cabs/flash/swflash.cab#version=6,0,29,0" width="468" height="60"><param name="movie" value="http://pepsi.flash8.net/pepsi46860.swf">
<param name="wmode" value="opaque"><param name="quality" value="high"><embed src="/upload/tech/20091104/20091104153839_faa9afea49ef2ff029a833cccc778fd0.swf" quality="high" pluginspage="http://www.macromedia.com/go/getflashplayer" type="application/x-shockwave-flash" width="468" height="60"></embed></object>
<div style="position:absolute;left:150;top:50;width:100px;height:50px;background:green">
</div>
或者用<param name="wmode" value="transparent">
<object classid="clsid:D27CDB6E-AE6D-11cf-96B8-444553540000" codebase="http://download.macromedia.com/pub/shockwave/cabs/flash/swflash.cab#version=6,0,29,0" width="468" height="60"><param name="movie" value="http://pepsi.flash8.net/pepsi46860.swf">
<param name="wmode" value="transparent"><param name="quality" value="high"><embed src="/upload/tech/20091104/20091104153839_faa9afea49ef2ff029a833cccc778fd0.swf" quality="high" pluginspage="http://www.macromedia.com/go/getflashplayer" type="application/x-shockwave-flash" width="468" height="60"></embed></object>
<div style="position:absolute;left:150;top:50;width:100px;height:50px;background:green">
</div>
2.被图片挡住
这个估计是因为图片也放在层中,而图片所在层的Z轴索引值比该层大,所以被挡住,解决办法是更改该层的Z轴索引值至比图片层大。
<div style="position:absolute;left:0;top:20;z-index:2;background:red;width:120px;height:70px">
1<img src="/upload/tech/20091104/20091104153841_5705e1164a8394aace6018e27d20d237.gif">
</div>
<div style="position:absolute;left:50;top:50;z-index:2;background:green;width:120px;height:70px">
2<img src="/upload/tech/20091104/20091104153841_5705e1164a8394aace6018e27d20d237.gif">
</div>
<div style="position:absolute;left:90;top:80;z-index:2;background:blue;width:120px;height:70px">
3<img src="/upload/tech/20091104/20091104153841_5705e1164a8394aace6018e27d20d237.gif">
</div>
3.被表单控件挡住
这个目前还没有完美的解决方法,一般都是在设计排版时就尽量避免这种情况,如果是万不得已,就在层经过表单控件时让表单控件隐藏,过后再让它显示:
<button onClick="oSelect.style.display='none';oLayer.style.display='inline'">显示层隐藏下拉选项</button><button onClick="oSelect.style.display='inline';oLayer.style.display='none'">显示下拉选项隐藏层</button>

<div style="position:absolute;left:0;top:50;z-index:2;background:red;width:120px;height:50px">
z-index:1<select id="oSelect"></select>
</div>
<div id="oLayer" style="position:absolute;left:30;top:60;z-index:2;background:green;width:120px;height:70px;display:none">
z-index:2<img src="/upload/tech/20091104/20091104153841_5705e1164a8394aace6018e27d20d237.gif">
</div>
当然还有用优先级别较高的控件来代替层的方法解决,但控件并非是每台机器上都有安装,而且控件的可定制性也差,也就是常说的兼容性问题:
hhctrl.ocx
<OBJECT id=hhctrl type="application/x-oleobject" classid="clsid:adb880a6-d8ff-11cf-9377-00aa003b7a11" codebase="<I>file:</I>hhctrl.ocx#Version=4,0,0,24" width=80 height=20>
<PARAM name="Command" value="Related Topics, MENU">
<PARAM name="Button" value="Menu">
<PARAM name="Item1" value="[X-Eyes];http://x-lover.com/forums/">
<PARAM name="Item2" value="闪客之吧;http://www.flash8.net">
<PARAM name="Item3" value="零刻联盟;http://www.linkmeng.com/">
<PARAM name="Item4" value="蓝色理想;ht"