CSS properties remove the dotted line when linking Images

Source: Internet
Author: User

CSS
An outline is a line drawn around an element. It is located at the periphery of the border edge and can highlight an element.

The outline attribute is a short attribute used to set the outlines around an element.

Note: The contour line does not occupy space or must be a rectangle.

You can add this attribute a: Active {outline: None} to the click link}
Unfortunately, it is invalid to add a: Active {BLR: expression (this. onfocus = This. Blur ();} in IE ());}

That's it.
<Style>
A: active {outline: none; BLR: expression (this. onfocus = This. Blur ());}
</Style>
In this way, all links on the webpage are not dotted-box (text links and image links =)
Example:
<Style>
A: active {outline: none; BLR: expression (this. onfocus = This. Blur ());}
IMG, A. IMG {border: 0}
</Style>
<A href = "#"> </a> <br>
<A href = "#"> </a> <br>
<A href = "#"> post </a>

Local Control

<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>

Global Control

CSS implementation

A {BLR: expression (this. onfocus = This. Close ());}/*Only Internet Explorer is supported, which is inefficient when used too much.*/

A {BLR: expression (this. onfocus = This. Blur ());}/*Only Internet Explorer is supported, which is inefficient when used too much.*/

A: Focus {-moz-Outline-style: none ;}/*Internet Explorer does not support*/

HTC implementationIE support. It works only after the page is loaded.

Take the following sectionCodeFiles with the extension. HTC

<Public: attach event = "onfocus" onevent = "hscfsy ()"/>
<Script language = "JavaScript">
Function hscfsy (){
This. Blur ();
}
</SCRIPT>

Call a {behavior: URL (path of the HTC file )}

JS traversal implementation

Window. onload = function ()
{
For (var ii = 0; II <document. Links. length; II ++)
Document. Links $ [$ II $] $. onfocus = function () {This. Blur ()}
}

JS encapsulation as a function

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 ();};
}

Currently, an attribute of hidefocus is added. The commented out sentence is to add onfucus = This. Blur ();
Then call fhidefocus ("A") to remove the dotted box of.
You can remove more dashed boxes by passing different parameters. For example, you can remove
But remember to use uppercase letters for parameters.

A. How do I eliminate the dotted line of links in the map area?

This is a conceptual error. In fact, we should control the map image, rather than in the area. Refer to the traditional method.

B. About onfocus

<A href = "http://blog.csdn.net/alonesword/" onfocus =" This. Blur () ">

</A>

Onfocus is something to set the mouse focus event. This can be used or not, but to make more browsers recognize it, we recommend that you use border = 0, which is the key to removing the dotted box (on the Internet, we can see that some people use onfocus = "this. blur () "to eliminate dotted boxes, but this statement cannot be used only during local testing)

Related Article

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.