frosty
frosty

Reputation: 2649

Changing the border color of a submit button after clicking it, CSS, HTML

I have a submit button with the background color of green. When clicking on it, it changes the background color to red, but after clicking it, the background color changes back to green, and there is a blue border surrounding the button. I'm wondering if there is a way to get rid of the blue borders? Thank you.

input[type=submit] {
background-color: green;
}
input[type=submit]:active {
background-color: red;
}

<input type = 'submit' value = 'Click me'>

Upvotes: 1

Views: 5858

Answers (2)

Cristian Cristea
Cristian Cristea

Reputation: 94

Want do you want to do with the button, should he be green or red after click? Remove the border( if the elem has one ) and the outline....should do the trick.
http://www.w3schools.com/css/css_link.asp

input[type=submit]:active{
      background-color: green;
      outline: 0;
      border: none;
    } 

Upvotes: 0

Chrillewoodz
Chrillewoodz

Reputation: 28348

Set outline to 0 and add :focus to the button, which means after it has been clicked and remains in focus.

input[type=submit]:focus {
  background-color: green;
  outline: 0;
} 

Upvotes: 2

Related Questions