Home > Web Front-end > HTML Tutorial > Various ways to remove link dotted boxes with CSS and JS_html/css_WEB-ITnose

Various ways to remove link dotted boxes with CSS and JS_html/css_WEB-ITnose

WBOYWBOYWBOYWBOYWBOYWBOYWBOYWBOYWBOYWBOYWBOYWBOYWB
Release: 2016-06-24 12:00:04
Original
1554 people have browsed it

When we click on a link, a dotted box will be displayed around the link. So how to remove this dotted box? In fact, there are many methods, just use CSS, but using javaScript seems to be a good method as well.

1. CSS method to remove the link dotted frame:
In IE, use the html attribute: hideFoucs, and add the hidefocus="true" attribute to the HTML tag, but this attribute is IE If it is private, Firefox will not recognize it. Front-end framework example

. Code

Processed with CSS in IE:

. Code

  1. a{noOutline:expression(this.onFocus=this.blur());}/* "onFocus" Note the case*/

Firefox’s processing method is more in line with the standard. You only need to set a:focus{outline:none} in the CSS style code. Next, let’s take a look at the unified processing method in MSIE and FF:

. Code

  1. a{
  2. outline:none ; /*FF*/
  3. noOutline:expression(this.onFocus=this.blur());/*IE*/
  4. }

Considering performance optimization, you can refer to the following code:

. Code

  1. a{outline:none;}
  2. a:active{noOutline:expression(this.onFocus=this.blur());}
  3. :focus{outline:0;}

2. Use js to solve the link virtual box method: front-end framework example

. Code

  1. < script language="javascript">
  2. $("a").bind("focus", function(){
  3. if(this.blur){
  4. this.blur();
  5. }
  6. });
source:php.cn
Statement of this Website
The content of this article is voluntarily contributed by netizens, and the copyright belongs to the original author. This site does not assume corresponding legal responsibility. If you find any content suspected of plagiarism or infringement, please contact admin@php.cn
Latest Issues
Where is js written?
From 1970-01-01 08:00:00
0
0
0
js addClass not working
From 1970-01-01 08:00:00
0
0
0
js file code not found
From 1970-01-01 08:00:00
0
0
0
Popular Tutorials
More>
Latest Downloads
More>
Web Effects
Website Source Code
Website Materials
Front End Template