I have been trying to make my own button and for some reason I don't seem to get the :disable to work right. I want the button to be disabled (not respond to click and grey text). What am I missing?
HTML:
<!doctype html>
<div id="menu">
<a class="button" disabled="true" id="button">Click</a>
</div>
CSS:
.button {
display: block;
width: 40%;
text-align: center;
float: left;
color: #000000;
font-size: 10px;
padding: 0.5em 1em;
text-decoration: none;
-webkit-user-select: none; /* Chrome/Safari */
-moz-user-select: none; /* Firefox */
-ms-user-select: none; /* IE10+ */
/* Rules below not implemented in browsers yet */
-o-user-select: none;
user-select: none;
}
.button:hover {
background: #f0f0f0;
text-decoration: none;
}
.button:active {
background: rgb(150, 150, 150);
background-image: linear-gradient(to bottom, rgb(150, 150, 150), rgb(200, 200, 200));
text-decoration: none;
}
.button:disabled {
color:rgb(150, 150, 150);
}
Also, this is going to be used with javascript. Is this enough in the js to change the disabled state?
button = document.querySelector("#button");
button.disabled = true;