使用CSS表达式去除超链接的虚框的一些方法

from:http://www.zhufengpeixun.cn/jishuziliao/CSS3heHTML4zhuanti/2014-05-08/292.html

去除超链接的虚框的一些方法 

1. a{ 


blr:expression(this.onFocus=this.blur());/*IE使用*/ 
outline-style:none;/*FF使用*/ 
} /*去除a标签带来的虚框*/ 
2、全 局控制  CSS实现 
a{blr:expression(this.onFocus=this.close());} /* 只支持IE,过多使用效率低 */   
a{blr:expression(this.onFocus=this.blur());} /* 只支持IE,过多使用效率低 */   
a:focus { -moz-outline-style: none; } /* 支持火狐   IE不支持 */ 

方法一: 
<a οnfοcus=this.blur() href="javascript:void(0)" class="l-button" style="width:80px" οnclick='log_1()'> 
<img id="img_a" border=0 align="middle" src="login_image/a_1.jpg" alt="没有图片!"> </img> 
</a> 
οnfοcus=this.blur()  增加这个,可以去掉! 

方法二: 
1.把以下代码存成一个1.htc的文件
<public:attach event="onfocus" onevent="quit()" /> 

<script language="javascript"> 
function quit(){ 
this.blur(); 

</script> 
2.在你的html文件head中加入以下代码,这样所有的连接都没虚线了
<style> 

a {behavior:url(1.htc)} 
area {behavior:url(1.htc)} 
</style> 

总结方法:
去掉链接时的虚框只要在你的样式表中加入以下代码,就可以去掉链接时烦的的虚框   
a,area { blr:expression(this.onFocus=this.blur()) } /* for IE */
:focus { -moz-outline-style: none; } /* for Firefox */   

  • 0
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 0
    评论
可以使用CSS的伪类选择器`:hover`和属性选择器`[attribute=value]`来实现超链接在新窗口打开的效果,具体方法如下: ```css a[target="_blank"]:hover { cursor: pointer; } a[target="_blank"]::after { content: "\2197"; /* 这是一个箭头符号,可以根据需要修改 */ margin-left: 5px; } a[target="_blank"]::after:hover { color: red; /* 可以根据需要修改箭头颜色 */ } /* 如果需要同时设置外部链接和内部链接在新窗口打开,可以使用如下代码 */ a[target="_blank"], a[href^="http"]:not([href*="example.com"]):not([href*="example.net"]) { /* 上面的选择器表示只针对带有target="_blank"属性的链接和不包含"example.com"或"example.net"域名的http链接生效 */ cursor: pointer; } a[target="_blank"]::after, a[href^="http"]:not([href*="example.com"]):not([href*="example.net"])::after { content: "\2197"; margin-left: 5px; } a[target="_blank"]::after:hover, a[href^="http"]:not([href*="example.com"]):not([href*="example.net"])::after:hover { color: red; } ``` 上述代码中,选择器`a[target="_blank"]`表示选择带有`target="_blank"`属性的超链接,`a[target="_blank"]:hover`表示当鼠标悬停在这些链接上时的效果,`a[target="_blank"]::after`和`a[target="_blank"]::after:hover`表示在链接后面添加一个箭头符号和鼠标悬停时的效果。 如果需要同时设置内部链接和外部链接在新窗口打开,可以使用属性选择器`[href^="http"]`选择所有以"http"开头的链接,并使用`:not()`排除某些特定域名的链接。同时,由于使用`:hover`伪类选择器只能选中已存在的元素,因此需要使用`::after`伪元素添加箭头符号。

“相关推荐”对你有帮助么?

  • 非常没帮助
  • 没帮助
  • 一般
  • 有帮助
  • 非常有帮助
提交
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值