`
天梯梦
  • 浏览: 13632793 次
  • 性别: Icon_minigender_2
  • 来自: 洛杉矶
社区版块
存档分类
最新评论

a标签position为absolute时,IE无法点击(a position:absolute bug ie)

 
阅读更多

为什么要把a标签搞为absolute呢?很多时候为了覆盖在其他html标签上,实现一些点击,比如一个flash广告,要想在整个flash上加一个链接,单击整块flash链接到某个网页。

 

用一个绝对定位的a标签覆盖在flash上:

<style>
.flash { width:200px;height;200px;position:relative; }
.flash-link { position : absolute; z-index : 2 ;  left: 0; top: 0 ; width: 100%; height: 100%; display: block; }
.flash-object { position : absolute; z-index: 1; left: 0; top: 0; width:300px; height:80px; }
</style>

<div class="flash">
<a class="flash-link"></a>
<div class="flash-object"><object>....flash嵌入代码</object> </div>
</div>

 

Firefox,Chrome, Opera等所有非IE浏览器均可以单击。但IE系列的浏览器却不行,经过仔细测试,发现a标签虽然display为block; 并且拥有width:100%; height:100%;但a这个时候表现的还是像inline元素一样,如果存在文字,则有文字链接,如果不存在,则完全点不到。

 

 

解决方法(让a变成块状block):

 

方法1.

 

给a加上一个background属性,写法:

 

background:url(about:blank) 或  background:url(#)

 

 

方法2. (推荐!)

 

给a加任意背景颜色,再把透明度设为透明(隐藏颜色),写法:

 

background:#fff;opacity:0; filter:alpha(opacity=0);

 

来源:http://www.phpvar.com/archives/852.html

 

 

分享到:
评论

相关推荐

    IE6实现position:fixed bug (固定窗口方法)的实例

    当我们去搜索解决这个bug的垮浏览器解决办法时,绝大多数结果都是说使用 position:absolute 来替代解决,可是我们真的解决了么?没有,因为当页面比较长的时候,拖动滚动条,那个fix的地方也相应的闪动.虽然最终会近似于...

    IE6中的position:fixed定位兼容性写法分享

    非IE6下的写法大家一般都清楚如何写;...}/* IE6 头部固定 */html .fixed-top{position:absolute;bottom:auto;top:[removed]eval&#40;document.documentElement.scrollTop&#41;);}/* IE6 右侧固定 */html .fixed-r

    js完美解决IE6不支持position:fixed的bug

    关于IE6,虽然它已被微软抛弃很久了,但是由于大天朝的特殊行情(盗版)对于前端工程师来说,解决IE6兼容position:fixed的问题显得很重要。特别是你需要用到头尾悬停调用的时候

    IE6不支持position:fixed bug的完美解决

    IE6 position:fixed bug&lt;/title&gt; &lt;style&gt; *{padding:0;margin:0} p{height:2000px} #gs{border:1px solid #000;position:fixed;right:30px;top:120px} &lt;/style&gt; &lt;!–[if IE 6]&gt;

    CSS IE6奇数宽度或高度的bug

    /*这里宽度为奇数,bug就出现了!!改成偶数就OK了*/ height: 300px; position: relative; background:#FF0000; color:#FFF; } #inn { width: 200px; height: 250px; position: absolute; top: 0px; right: 0px; ...

    IE6/7在滚动区域内的标签使用position会飘出这个滚动区域不随滚动条滚动

    最近才发现IE6、IE7存在这样一个BUG:在滚动区域(DIV中)内,如果里面的标签使用了position(absolute/relative),则会飘出这个滚动区域,且不会随滚动条而滚动(静止不动)。如下所示(只在IE6和IE7中才会出现此...

    IE6 fixed的完美解决方案

    } 这个方法有一个bug未解决:在IE6下会把所有position:absolute都变成“浮动”的元素;还有使用js方法滚动滚动条时会出现对象闪烁,如下方法结合了CSS和js的办法,解决了以上的问题。 代码如下: &lt;!DOCTYPE ...

    CSS表达式(expression)解决IE6 position:fixed无效问题

    IE6 position:fixed bug&lt;/title&gt; &lt;style&gt; *{padding:0;margin:0} p{height:2000px} #gs{border:1px solid #000;position:fixed;right:30px;top:120px} &lt;/style&gt; &lt;!–[if IE 6]&gt;

    IE6/7 and IE8/9/10(IE7模式)依次隐藏具有absolute或relative的父元素和子元素后再显示父元素

    多数情况下隐藏(设置display:none)一个元素,无需依次将其内的所有子元素都隐藏。非要这么做,有时会碰到意想不到的bug。

    css中关于定位属性position为fixed的使用记载

    在html中,当一个div想要定位时,我们第一反应是position属性,而position属性除了默认值外,还有absolute,relative和fixed。当被设置成fixed时,可以通过设置left、right、top、bottom的值来相对于body定位。 代码...

    ie6 fixed bug的解决方法 (css+js)

    复制代码代码如下: #fixed { position: absolute; top: 0; left: 0; width: 10em; height: 100%; } body &gt; #fixed { position: fixed; } #content { margin-left: 10em; background:red; height:800px; } 利用css...

    在IE6,7中遇到未知的问题无法解决时可以尝试触发其layout

    复制代码代码如下: height:1% position: absolute float: left | right display: inline-block width: !auto – 除auto以外的值 height: !auto – 除auto以外的值 zoom: !normal – 除normal以外的值 writing-mode: ...

    renxu-webuploader_demo-master.zip

    大文件断点续传,分片上传,二次封装百度webuploder,javaWeb版,简单易用。 相关说明: 如果开启分片上传,以下参数必须设置, 如果未开启,... .hiden{ position: absolute; opacity: 0; filter:Alpha(opacity=0); }

    网页制作完全手册

    As with any type of programming, writing bug-free, efficient scripts that meet your expectations takes a bit of work. The following sections provide some tips and hints to make that work take less ...

    javascript带颜色的欢迎窗口

    IE5 && W3C)window.onload=NS6bugfix; createPopup( 'box3', '欢迎光临' , 288, 90, 275, 155, true, 'FF9966' , '000000' , '800000' , '欢迎光临网页特效代码 网络因你而精彩' , 'FFFFFF' , 9 , '宋体'); ...

    ExtAspNet_v2.3.2_dll

    -这个BUG导致Asp.net compatibility中的示例无法完成,现在已经修正。 +去除PageManager中方法AddAjaxAspnetControls,增加属性AjaxAspnetControls。 -这个属性和Button得ValidateForms属性类似,可以查看Asp...

    ExtAspNet v2.2.1 (2009-4-1) 值得一看

    -这个BUG导致Asp.net compatibility中的示例无法完成,现在已经修正。 +去除PageManager中方法AddAjaxAspnetControls,增加属性AjaxAspnetControls。 -这个属性和Button得ValidateForms属性类似,可以查看Asp...

    JavaScript Table行定位效果

    接着想到的是给table插入一个新tr,克隆原来的tr,并设置这个tr为fixed(ie6为absolute),例如: Code &lt;!DOCTYPE ...

Global site tag (gtag.js) - Google Analytics