首页 技术 正文
技术 2022年11月9日
0 收藏 910 点赞 4,349 浏览 1817 个字

CSS 之
outline (轮廓)是绘制于元素周围的一条线,位于边框边缘的外围,可起到突出元素的作用。
outline 属性是一个简写属性,用于设置元素周围的轮廓线。
注释:轮廓线不会占据空间,也不一定是矩形。
这就可以了,就给点击链接加这个属性 a:active{outline:none}
可惜,IE下无效 再加一个 a:active {blr:expression(this.onFocus=this.blur());}
没错,就是这样了
<style>
a:active {outline:none;blr:expression(this.onFocus=this.blur());}
</style>
这样网页中的所有链接点击都没虚线框了(文字链接、图片链接==)
示例:
<style>
a:active {outline:none;blr:expression(this.onFocus=this.blur());}
img,a .img{border:0}
</style>
<a href=”#”> <img src=”http://www.jinyuanbao.cn“></a><br>
<a href=”#”> <img src=””></a><br>
<a href=”#”>发新帖</a>
局部控制
<a href=”link1.htm” onfocus=”this.blur()”>link1</a>
<a href=”link1.htm” onfocus=”this.close()”>link1</a>
<a href=”link1.htm” hidefocus=”true”>link1</a>
<a href=”link1.htm” hidefocus=”hidefocus”>link1</a>
全局控制
CSS实现
a{blr:expression(this.onFocus=this.close());} /* 只支持IE,过多使用效率低 */
a{blr:expression(this.onFocus=this.blur());} /* 只支持IE,过多使用效率低 */
a:focus { -moz-outline-style: none; } /* IE不支持 */
HTC实现 IE支持,页面载完才有效果
把下面这段代码存为.htc为扩展名的文件
<public:attach event=”onfocus” onevent=”hscfsy()”/>
<script language=”javascript”>
function hscfsy(){
this.blur();
}
</script>调用 a {behavior:url(htc文件所在路径地址)}
JS遍历实现
window.onload=function()
{
for(var ii=0; ii<document.links.length; ii++)
document.links$[$ii$]$.onfocus=function(){this.blur()}
}JS封装为函数
function fHideFocus(tName){
aTag=document.getElementsByTagName(tName);
for(i=0;i<aTag.length;i++)aTag$[$i$]$.hideFocus=true;
//for(i=0;i<aTag.length;i++)aTag$[$i$]$.onfocus=function(){this.blur();};
}当前是添加一个hidefocus的属性,注释掉的句子是添加onfucus=this.blur();
然后调用fHideFocus(“A”),即可把a的虚线框去掉
通过传递不同的参数,可以去掉更多的虚线框,比如”BUTTON”可以去掉button的
但要记住参数要用大写字母
A. map area内链接如何消除链接虚线?
这是一个观念上的错误,其实应该在所在map的图片上加以控制,而不是在area内,参考传统办法
B. 关于onFocus
<a href=““ onFocus=”this.blur()”>
<Img Src=”Example.jpg” Border=0>
</a>onFocus是设置鼠标焦点事件的东西,这个可以用,也可以不用,不过为了让更多的浏览器识别的话,建议采用Border=0 这个才是去除虚线框的关键所在(在网上看到有的人用onFocus=”this.blur()”来消除虚线框,但在本地测试时,仅仅用这一句是不能消除的)

相关推荐
python开发_常用的python模块及安装方法
adodb:我们领导推荐的数据库连接组件bsddb3:BerkeleyDB的连接组件Cheetah-1.0:我比较喜欢这个版本的cheeta…
日期:2022-11-24 点赞:878 阅读:8,910
Educational Codeforces Round 11 C. Hard Process 二分
C. Hard Process题目连接:http://www.codeforces.com/contest/660/problem/CDes…
日期:2022-11-24 点赞:807 阅读:5,435
下载Ubuntn 17.04 内核源代码
zengkefu@server1:/usr/src$ uname -aLinux server1 4.10.0-19-generic #21…
日期:2022-11-24 点赞:569 阅读:6,250
可用Active Desktop Calendar V7.86 注册码序列号
可用Active Desktop Calendar V7.86 注册码序列号Name: www.greendown.cn Code: &nb…
日期:2022-11-24 点赞:733 阅读:6,061
Android调用系统相机、自定义相机、处理大图片
Android调用系统相机和自定义相机实例本博文主要是介绍了android上使用相机进行拍照并显示的两种方式,并且由于涉及到要把拍到的照片显…
日期:2022-11-24 点赞:512 阅读:7,693
Struts的使用
一、Struts2的获取  Struts的官方网站为:http://struts.apache.org/  下载完Struts2的jar包,…
日期:2022-11-24 点赞:671 阅读:4,731