xxxxxxxxxx
<!DOCTYPE html>
<html>
<head>
<style>
.clicked {
color: red;
font-weight: bold;
}
</style>
</head>
<body>
<button onclick="applyStyles()">Click me!</button>
<script>
function applyStyles() {
var button = document.querySelector('button');
button.classList.toggle('clicked');
}
</script>
</body>
</html>
xxxxxxxxxx
<style>
.button {
padding: 10px 20px;
background-color: #ccc;
}
.button:active {
background-color: #999;
}
</style>
<button class="button">Click me</button>