IE6/7下多種方法移除button、input 默認邊框和去掉焦點線
一、去掉邊框:
看看基本的HTML:
復制代碼代碼如下:
div class="wrap"
input type="text" class="input_txt"
input type="submit" value="https://www.questions.com.cn/dnjc/submit" class="input_btn"
input type="button" value="https://www.questions.com.cn/dnjc/提交" class="input_btn"
div
通常解決這樣的bug最好的方法就是在button和input的標簽外添加一個標簽 , 然后將樣式寫在這個標簽上,并且把button和input的默認樣式都去除掉 。
實現方式一:設置CSS:
復制代碼代碼如下:
style type="text/css"
input{margin:0;padding:0;}
.wrap{background-color:#0f0;}
.input_txt,.input_btn{border:0 none;}
/style
實現方式二:設置CSS,并使用濾鏡:
復制代碼代碼如下:
!--[if IE]
style type="text/css"
input{margin:0;padding:0;filter:chroma(color=#000000);border:none; }
.wrap{background-color:#0f0;}
/style
![endif]--
此種方式貌似會有點問題!待在真實IE7環境中驗證 。
二、去掉焦點線:
復制代碼代碼如下:
style type="text/css"
a:focus, *:focus {noFocusLine: expression(this.onFocus=this.blur());}
/style
