DEV Community

Cover image for CSS Battle: #8 - Forking Crazy
Jatin Sharma
Jatin Sharma

Posted on

CSS Battle: #8 - Forking Crazy

In this article, I will solve a Forking Crazy 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:
Forking Crazy

Solution

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

HTML

<div class="root"></div>
<div class="slot"></div>
<div class="point"></div>
<div class="handle"></div>
Enter fullscreen mode Exit fullscreen mode

CSS

Now let's style the containers.

body {
  margin: 0;
  background: #6592cf;
  display: grid;
  place-items: center;
}
.root {
  position: absolute;
  width: 140;
  height: 190;
  background: #060f55;
  border-radius: 0 0 100px 100px;
  margin-top: 10;
}
.slot {
  width: 20;
  height: 100;
  background: #6592CF;
  z-index: 1;
  border-radius: 0 0 100px 100px;
  margin:20 0 0 0;
  box-shadow: -40px 0 0 #6592CF, 40px 0 0 #6592CF;
}
.point {
  width: 20;
  height: 20;
  background: #060F55;
  border-radius: 10px;
  transform: translate(-60px, -190px);
  box-shadow : 40px 0 0 #060F55, 80px 0 0 #060F55, 120px 0 0 #060F55; 
}

.handle{
  position: absolute;
  bottom:0;
  width: 20;
  height:60;
  background: #060F55;
}
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.

Codepen

Video

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 (1)

Collapse
 
gass profile image
Gass

My approach was way different... Your approach is very creative, I would have never thought about using ´box-shadow´.. 👍