开发者

Change color of dotted border on button

开发者 https://www.devze.com 2022-12-13 22:21 出处:网络
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 开发者_Python百科it. I would like to remove this, but I don\'t know how. I ha

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 开发者_Python百科it. I would like to remove this, but I don't know how. I haven't set this border in the CSS...

Change color of dotted border on 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?)


That is the outline

You can change it like this:

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


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 */
}


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


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();"
0

精彩评论

暂无评论...
验证码 换一张
取 消

关注公众号