linkedin Skip to Main Content
Just announced: CoderPad Play! Engage your team with fun technical challenges.
Back to blog

Code Challenge: Toggle With CSS

Coding Challenges

For this code challenge, you have been tasked with improving the aesthetic of a web page by implementing a color mode toggle and adding animations.

The goal of this challenge is to test your understanding of HTML and CSS by completing the task items:

  • On the top right corner of the page, you should find the moon icon. Clicking on it should toggle between light and dark mode but nothing happens at the moment. You are required to create a class titled dark-mode with your focus on styling the class to attain dark mode.
  • The picture element has been created in the index.html file. You are to add images inside the element using the html source element. The goal is to add two images. One of them will be rendered when max-width is 500px and the other on larger viewports.

We have provided some template code in the sandbox to get you started. Implement your solution in the sandbox below:

Code challenge solution

Verify your solution with the official solution in this sandbox.

Want to conduct interviews on this platform?

Check out CoderPad : pick any interview question or create your own, then invite your candidate to a shared live-coding session on an IDE like this one. You even get 2 free interviews per month forever using this registration link!