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:
Solution
So now look at the Solution and how we are going to achieve this.
HTML
index.html
<div class="root"></div>
<div class="slot"></div>
<div class="point"></div>
<div class="handle"></div>
CSS
Now let's style the containers.
styles.css
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;
}
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
Wrapping up
There are many ways to solve this. You can share your approach in the comments. If you like this then you can extend your support by Buying me a Coffee
Jatin's Newsletter
I write monthly Tech, Web Development and chrome extension that will improve your productivity. Trust me, I won't spam you.