<button id="color">Click me</button>
<style>
#color {
transition-property: background-color;
transition-duration: 3s;
}
</style>
<script>
color.onclick = function() {
this.style.backgroundColor = 'red';
};
</script>
This Pen doesn't use any external CSS resources.
This Pen doesn't use any external JavaScript resources.