<button>hello</button>
button {
opacity: 0.8;
background-color: #4CAF50; /* Green */
border: none;
color: white;
padding: 15px 32px;
text-align: center;
text-decoration: none;
display: inline-block;
font-size: 16px;
transition-duration: 0.4s;
}
button:hover {
background-color: #4CAF50; /* Green */
opacity: 1;
color: white;
}
button:focus {
border: 2px solid blue;
}
body.using-mouse :focus {
animation: none;
border: none;
outline: none;
}
document.querySelector('button').addEventListener('click', (e) => {
e.preventDefault();
alert('a');
})
document.body.addEventListener("mousedown", () => {
document.body.classList.add("using-mouse");
});
document.body.addEventListener("keydown", ({ key }) => {
if (key === "Tab") {
document.body.classList.remove("using-mouse");
}
});
This Pen doesn't use any external CSS resources.
This Pen doesn't use any external JavaScript resources.