Jatin Sharma
Posted on January 6, 2023
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:
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;
}
Note: In CSS Battle you can use
100
instead of100px
. You don't need to definepx
in CSS. However, if you are usingrem
or%
, you need to pass them separately. That's why in the above CSS code there are no units mostly. For more info visit hereMinify 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}
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.
Posted on January 6, 2023
Join Our Newsletter. No Spam, Only the good stuff.
Sign up to receive the latest update from our blog.