Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

CSS How to get rid of border that appears around custom button on and after click

Tags:

html

css

dart

I have a custom button class (created on-line as this is my first attempt at a web page). When it is clicked and until something else is clicked a grayish border appears around the button as a box with probably a two pixel thickness. When something else is clicked it goes away (My custom button has rounded corners so it is quite visible.

This does not appear on Safari on OS-X but does appear with Chrome. With FireFox the border is 1 pixel thick and appears a box inside my custom box. (It's not going to run on IE as we are stuck with IE8 for a while.) It is annoying.

HTML:

<button class='command-btn' type='button' id='find-camera-btn'>Find Camera</button>

CSS3:

.command-btn {
   font-family: Arial, Helvetica, sans-serif;
   font-size: 16px;
   color: blue;
   width: 130px;
   height: 40px;
   float: left;
   margin: 6px 0px 5px 10px;
   background: -moz-linear-gradient(top, #0aa31b 0%, #d7de16 99%, #ebeb0e);
   background: -webkit-gradient(linear, left top, left bottom, from(#0aa31b),
     color-stop(0.99, #d7de16), to(#ebeb0e));
  -moz-border-radius: 14px;
  -webkit-border-radius: 14px;
   border-radius: 14px;
   border: 1px solid #6d8000;
   -moz-box-shadow: 0px 1px 3px rgba(000, 000, 000, 0.5), inset 0px 0px 2px
     rgba(255, 255, 255, 1);
   -webkit-box-shadow: 0px 1px 3px rgba(000, 000, 000, 0.5), inset 0px 0px
      2px rgba(255, 255, 255, 1);
   box-shadow: 0px 1px 3px rgba(000, 000, 000, 0.5), inset 0px 0px 2px
     rgba(255, 255, 255, 1);
   text-shadow: 0px -1px 0px rgba(000, 000, 000, 0.2), 0px 1px 0px
     rgba(255, 255, 255, 0.4);
}

I'm using Dart but it doesn't matter what code is in the "OnClick" method. If I could move the focus after the click that would solve the problem but I don't know how to do that.

like image 383
Nate Lockwood Avatar asked Feb 28 '14 00:02

Nate Lockwood


People also ask

How to remove the border around the text in HTML?

However, you can use CSS to remove the border: Step 1) Add HTML: Example <p contenteditable="true">This is an editable paragraph.</p> Step 2) Add CSS:

What is the use of border in CSS?

The border property is used to provide the borders to the buttons for which we use border-radius property is used for styling button borders for rounding the corners of the buttons. We can also provide give double stroke by adding another border property on the inner span element by reducing the border-radius property. Working of CSS Button Border

How to remove the border from an editable element?

Learn how to remove the border from an editable element. Remove Contenteditable Border By default, when you write inside an element that has contenteditableset to true, that element gets a border around on focus. However, you can use CSS to remove the border: Step 1) Add HTML: Example <p contenteditable="true">This is an editable paragraph.</p>

How can I remove the default borders on certain sides?

Also, you can remove the default borders on certain sides by setting them to "transparent". See another example where the outline: none; is set for <input>, <textarea> and <select> fields. How can we improve it? Thanks for your feedback!


2 Answers

Addind the rule:

outline: 0;

should do the work

like image 79
pna Avatar answered Oct 19 '22 07:10

pna


.command-btn,
.command-btn:focus,
.command-btn:active {
    border: 0;
    outline: 0;
}
like image 25
Deryck Avatar answered Oct 19 '22 09:10

Deryck