JSFiddle - React, Tailwind, and code Playground
HTML
<input type="text" value="Кликайте на костыль" readonly onclick="functionTest()">
<p>Так делать нельзя: input — не кнопка</p>
CSS
input::selection,
input:active::selection,
input:hover::selection,
input:hover:active::selection {
background: transparent
}
/* */
html,
body {
height: 100%;
max-height: 100vh;
overflow: hidden
}
body {
padding: 10px;
color: #FFF;
font-family: 'Helvetica Neue', 'Arial Nova', Helvetica, Arial, sans-serif;
background: #232323;
transition: all .15s;
display: flex;
align-items: center;
justify-content: center;
flex-flow: column
}
.click {
background: darkgreen
}
input {
background: linear-gradient(40deg, #FFF, red);
background-size: 25%;
background-repeat: no-repeat;
color: inherit;
width: 400px;
height: 80px;
max-width: 100%;
padding: 10px;
text-align: center;
font-size: 1.5rem;
outline: none;
border: 2px solid #FFF;
cursor: pointer;
border-radius: 20px;
transition: all .15s ease
}
input:hover {
background-size: 50%;
}
input:active {
background-size: 100%;
transform: scale(.96);
border-radius: 40px;
}
p {
text-align: center;
margin: .3em;
font-size: 1.4rem;
opacity: .5
}
* {
box-sizing: border-box
}
JavaScript
function functionTest() {
document.getElementsByTagName("body")[0].classList.toggle("click");
}