DEV Community

Cover image for CSS Battle: #17 - Fidget Spinner
Jatin Sharma
Jatin Sharma

Posted on

CSS Battle: #17 - Fidget Spinner

In this article, I will solve a Fidget Spinner CSS Challenge on CSS Battle. Let's look at the problem first.

Problem

We need to create the following container by using CSS Properties only:
Fidget Spinner

Solution

So now look at the Solution and how we are going to achieve this.

CSS

You don't need HTML in this, you can achieve this only with CSS:

* {
  background: #09042a;
  margin: 60 55;
}
* > * {
  width: 60;
  height: 60;
  border-radius: 1in;
  color: #09042a;
  box-shadow: 0 0 0 10px #e78481, 
              120px 0, 
              120px 0 0 10px #e78481,
              60px -53px #f5bb9c, 
              60px -53px 0 10px, 
              60px 53px #f5bb9c, 
              60px 53px 0 10px,
              60px 0 0 5px #e78481;
}  
Enter fullscreen mode Exit fullscreen mode

Note: In CSS Battle you can use 100 instead of 100px. You don't need to define px in CSS. However, if you are using rem or %, you need to pass them separately. That's why in the above CSS code there are no units mostly. For more info visit here

Minify the code or CSS by using any CSS Minifier. It helps you to reduce the characters in the code which will increase the score.

Minified Version:

<style>*{margin:60 55;background:#09042A}*>*{width:60;height:60;border-radius:1in;color:#09042A;box-shadow:0 0 0 10px #E78481,120px 0,120px 0 0 10px #E78481,60px -53px #F5BB9C,60px -53px 0 10px,60px 53px #F5BB9C,60px 53px 0 10px,60px 0 0 5px #E78481}
Enter fullscreen mode Exit fullscreen mode

Wrapping up

There are many ways to solve this. You can share your approach in the comments. If you like this then don't forget to ❤️ it. And I'll see you in the next article. See you soon.

Top comments (0)