3

I'm using a CSS3 for my buttons. I noticed that whenever I click on any of the buttons, a rectangular blue highlight comes out around the button. I don't know if there's any way I can take it off. Here's my code:

    .navbar-custom {
        background-color:#000000;
        color:#ffffff;
        border-radius:0;
        height:100px;
        }

.btn {
  box-sizing: border-box;
  appearance: none;
  background-color: transparent;
  border: 2px solid #e74c3c;
  border-radius: 0.6em;
  color: #e74c3c;
  cursor: pointer;
  display: flex;
  align-self: center;
  font-size: 1rem;
  font-weight: 400;
  line-height: 1;
  margin: 20px;
  padding: 1.2em 2.8em;
  text-decoration: none;
  text-align: center;
  text-transform: uppercase;
  font-family: 'Montserrat', sans-serif;
  font-weight: 700;
}
.btn:hover, .btn:focus {
  color: #fff;
  outline: 0;
}
.sixth {
  border-radius: 3em;
  border-color: #ec6800;
  color: #FFF;
  background-image: linear-gradient(to bottom, transparent 50%, #2ecc71 50%);
  background-position: 0 0;
  background-size: 200%;
  transition: background 150ms ease-in-out, color 150ms ease-in-out;
}

</style>

</head>

<body>

     <nav class="navbar navbar-custom">
        <ul class="nav navbar-nav navbar-right">
           <button class="btn sixth">SIGN UP</button>
               </ul> </nav>          
</body>
  • There you go: https://stackoverflow.com/a/25298082/2936363 – Selrond Oct 01 '17 at 09:53
  • Possible duplicate of [Remove blue border from css custom-styled button in Chrome](https://stackoverflow.com/questions/20340138/remove-blue-border-from-css-custom-styled-button-in-chrome) – Roman Skydan Oct 01 '17 at 12:15

2 Answers2

1

The button already has the property outline: 0; which should take care of this, there must be some CSS overriding this property, you use either outline:none or outline:0, both basically do the same thing, refer here so modify the property to.

Before:

.btn:hover, .btn:focus {
  color: #fff;
  outline: 0;
}

After:

.btn:focus {
  color: #fff;
  outline: 0 !important;
}

.navbar-custom {
  background-color: #000000;
  color: #ffffff;
  border-radius: 0;
  height: 100px;
}

.btn {
  box-sizing: border-box;
  appearance: none;
  background-color: transparent;
  border: 2px solid #e74c3c;
  border-radius: 0.6em;
  color: #e74c3c;
  cursor: pointer;
  display: flex;
  align-self: center;
  font-size: 1rem;
  font-weight: 400;
  line-height: 1;
  margin: 20px;
  padding: 1.2em 2.8em;
  text-decoration: none;
  text-align: center;
  text-transform: uppercase;
  font-family: 'Montserrat', sans-serif;
  font-weight: 700;
}

.btn:hover,
.btn:focus {
  color: #fff;
  outline: none !important;
}

.sixth {
  border-radius: 3em;
  border-color: #ec6800;
  color: #FFF;
  background-image: linear-gradient(to bottom, transparent 50%, #2ecc71 50%);
  background-position: 0 0;
  background-size: 200%;
  transition: background 150ms ease-in-out, color 150ms ease-in-out;
}
<nav class="navbar navbar-custom">
  <ul class="nav navbar-nav navbar-right">
    <button class="btn sixth">SIGN UP</button>
  </ul>
</nav>
Naren Murali
  • 19,250
  • 3
  • 27
  • 54
0

Box-shadow helps in some cases

.btn:focus,.btn:active {
   outline: none !important;
   box-shadow: none !important;
}
Thyagarajan C
  • 7,915
  • 1
  • 21
  • 25