Create a Simple Color Flipper in JavaScript

Image for post
Image for post
Photo by Greg Rakozy on Unsplash

In this article, we are going to build a simple color flipper which will change the background to a random color, on the click of a button.

We are going to do this project in codepen. So, open any codepen and put this basic html and css. In the html, we have a container class wrapping a h2 and button.

In the CSS, we are placing the main at the center. Also, adding basic styles for h2 and color.

Image for post
Image for post
codepen

You can read the rest of the article from my blog site here.

You can find the codepen for this project here.

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