Remove button and Black Line Summary of link border

Source: Internet
Author: User

It's nothing to end with. The summary is complete. Let's look at it. The black box does damage the aesthetic of the page, so it's easy to get rid of it!

Some time ago, I saw a discussion on removing the "link/button" Dashed box on the Forum. Here I will record the methods I know and make a comparison.

Method 1: Use expression (this. hidefocus = true) in IE, and use outline: none in Firefox. (All buttons except FF do not take effect)Code:...
CSS:
.hideFocus{hide-focus: expression(this.hideFocus=true);}/* for ie 5+ */
.hideFocus{outline: none;}  /* for firefox 1.5 + */

HTML:
<A href = "#" class = "hidefocus"> I am a link and do not want a dotted line </a>
<Br/>
<Input type = "button" value = "I'm a button, and people don't want a dotted line."/>

The disadvantage of this method is that using expression in IE increases the burden on the browser, and the button cannot take effect in ff.

Method 2: Use JS onfocus = blur (); all take effect; Code:
CSS:None
HTML:
<A href = "#" onfocus = "Blur ()"> I am a link and do not want a dotted line </a>
<Br/>
<Input type = "button" value = "I'm a button, and people don't want dotted lines either." onfocus = "Blur ()"/>

The advantage of this method is that you do not need to write any CSS code or adapt to any situation. the disadvantage is that JS needs to be used, and the "link/button" will lose the focus status, which may cause trouble when detecting the "link/button" Focus status.

Method 3: Use the outline/border/zoom attribute to implement code:
CSS:
. Hidefocus2 {outline: 0; ZOOM: 1 ;}
. Hidefocus2:-moz-focus-inner {border-color: transparent! Important;}/* Make the button under FF take effect */

HTML:
<H3> method 3: combining outline/border/zoom attributes <A href = "#" class = "hidefocus2"> I am a link and do not want a dotted line </a>
<Br/>
<Input type = "button" value = "I'm a button, and people don't want a dotted line."/>

This method does not show obvious shortcomings for the moment, but it is not clear at the moment that ZOOM: 1; why can we remove the dotted line from IE6 because haslayout was promoted? After clarifying this issue, you will be back to record it.

PS: method 3: learn from "http://bbs.blueidea.com/thread-2929061-1-1.html". Thank you for sharing it!

 

Address: http://eosite.javaeye.com/blog/579171

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.