更改按钮上虚线边框的颜色

发布于 2024-08-15 00:51:33 字数 479 浏览 2 评论 0原文

我的其中一个表单中的按钮有问题,当用户单击该按钮时,它会在其中显示黑色虚线边框。我想删除这个,但我不知道如何删除。我没有在 CSS 中设置此边框...

按钮

((对于那些想知道的人;标题的意思是“搜索”))


我不久前搜索过,但用的是“虚线”而不是“点”,因此什么也没找到。我现在用“点”搜索,发现 这个,抱歉,但是有什么办法可以改变这个边框的颜色吗? (我认为这仅适用于 Firefox?)

I have a problem with a button in one of my forms, when a user clicks the button, it shows this black dotted border inside it. I would like to remove this, but I don't know how. I haven't set this border in the CSS...

Button

((For those wondering; the caption means "search"))


I searched some time ago, but with "dashed" instead of "dotted" and therefore found nothing. I searched with "dotted" now and found this, sorry, but is there any way to change the color of this border? (I think this only applies to firefox?)

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(4

肤浅与狂妄 2024-08-22 00:51:33

这是 outline

您可以这样更改它:

button {
    outline: 3px dashed #f0f;
    /* or, just the colour */
    outline-color: #f0f;
}

That is the outline

You can change it like this:

button {
    outline: 3px dashed #f0f;
    /* or, just the colour */
    outline-color: #f0f;
}
沫雨熙 2024-08-22 00:51:33

这是由 outline CSS 属性< /a>.要删除它,请将以下规则(或类似规则)添加到样式表中:

button.search {
    outline: none;
    -moz-outline: none; /* Firefox 1.0 and earlier, if you care */
}

That is controlled by the outline CSS property. To remove it, add the following rules (or similar) to your stylesheet:

button.search {
    outline: none;
    -moz-outline: none; /* Firefox 1.0 and earlier, if you care */
}
寂寞花火° 2024-08-22 00:51:33

我很抱歉没有弄清楚这个问题:这是在单击时发生的,我尝试过大纲属性,但讨厌的 Firefox 不接受它。通过阅读其他线程,我发现 答案

button::-moz-focus-inner { border: 0; }

I'm sorry for not being clear about the question: This happened when it was clicked, and I had tried the outline-attribute, but the pesky Firefox wouldn't accept it. By reading a little in the other thread, I found the answer:

button::-moz-focus-inner { border: 0; }
深爱不及久伴 2024-08-22 00:51:33

根据评论:

您是否知道这样您就无法再通过键盘导航找到该按钮了?

不,我没有,我以为 :active-event 会启动并拯救我的日子,但显然没有。你知道有什么解决办法吗?

考虑

onclick="this.blur();"

As per the comments:

Are you aware that this way you can't find the button anymore by keyboard navigation?

no I wasn't, I assumed the :active-event would kick in and save my day, but it obviously didn't. Do you know any solution?

consider

onclick="this.blur();"
~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文