这是我在这里问的第一个问题是堆栈溢出。
我有一个问题,一直困扰着我。
当我在页面上加载了多个按钮的页面时,HTML标记中的第一个按钮似乎会在按钮周围显示这个边框。
我很抱歉,如果之前已经提出这个问题,但我已经阅读了许多与此问题相关的论坛,但到目前为止,这个问题与解决此问题的建议无法解决。我猜它与页面加载时按钮的焦点有关,因为按下键盘按钮时可用。
我希望有一种方法来设置这个按钮的样式,当IE 7及以上的焦点模式通过javascript或后面的代码。我正在使用VB.net,但如果背后的代码是要走的话,我会非常感谢C#示例。
非常感谢任何帮助。
谢谢杰克
答案 0 :(得分:1)
尝试使用:focus伪类为按钮应用CSS样式,这可能允许更改按钮的样式。不知道是否所有主流浏览器都支持。
答案 1 :(得分:1)
你可以尝试在一个范围内包裹按钮,让跨度边框并将其从按钮中删除吗?
<强>样式:强>
<style type="text/css">
.span-button INPUT { background-color: transparent; border-width: 0px; }
.span-button { background: Silver; border: 1px solid red; }
</style>
<强> HTML 强>
<span class="span-button"><input type="button" value="wrapped button" /></span>
答案 2 :(得分:1)
如果您的意思是粗边框:IE为表单上的第一个提交按钮执行的默认突出显示,请检查:Stopping IE from highlighting the first submit-button in a form
答案 3 :(得分:1)
使用其中任何一种CSS样式
a:active, a:focus,input, input:active, input:focus{ outline: 0; outline-style:none; outline-width:0; }
a:active, a:focus,button::-moz-focus-inner, input[type="reset"]::-moz-focus-inner, input[type="button"]::-moz-focus-inner, input[type="submit"]::-moz-focus-inner, input[type="file"] > input[type="button"]::-moz-focus-inner
{ border: none; }
OR
:focus {outline:none;} ::-moz-focus-inner {border:0;}
完成CSS样式部分后,您可能还需要设置IE-Emulator。更新您的Web应用程序web.config文件并包含以下密钥。
<system.webServer>
<httpProtocol>
<customHeaders>
<clear />
<add name="X-UA-Compatible" value="IE=7; IE=9; IE=8; IE=5;" />
</customHeaders>
</httpProtocol>
</system.webServer>