Transition animation for background change

For smooth animation on a webpage, we should use the opacity CSS property to animate changes in background-color. But how? Use the pseudo element with a new background-color value and toggle its opacity value between 0 and 1!


body {
/* Set the default background color */



Get the Medium app

A button that says 'Download on the App Store', and if clicked it will lead you to the iOS App store
A button that says 'Get it on, Google Play', and if clicked it will lead you to the Google Play store

Self-taught web app designer/developer, currently building an app to save rich text notes about places on Google Maps.