Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How to prevent button text movement when button is active in Firefox?

Sample:

<button>Button</button>


button {
    border: medium none;
    margin-top: 17px;
    width: 224px;
    height: 40px;
    background: none repeat scroll 0% 0% #7BA6BB;
    color: #FFF;
    outline: medium none;
    cursor: pointer;
}

http://codepen.io/anon/pen/ByaLZN

Browser: Mozilla Firefox (the latest version)

When button is clicked (active), button text moves right. How To prevent it?

like image 978
AlexAstanin Avatar asked Nov 13 '14 11:11

AlexAstanin


1 Answers

As one of solutions : add padding:0 for button:active

button {
  border: medium none;
  margin-top: 17px;
  width: 224px;
  height: 40px;
  background: none repeat scroll 0% 0% #7BA6BB;
  color: #FFF;
  outline: medium none;
  cursor: pointer;
}

button:active {
  padding: 0px;
}
<button>Button</button>

Or you can add span(or maybe another tag that you like) into your button like this here:

button {
  border: medium none;
  margin-top: 17px;
  width: 224px;
  height: 40px;
  background: none repeat scroll 0% 0% #7BA6BB;
  color: #FFF;
  outline: medium none;
  cursor: pointer;
}

button:active {
  padding: 0px;
}
<button><span>Button</span></button>
like image 179
demo Avatar answered Oct 22 '22 04:10

demo