CSS Battle: #2 - Carrom

In this article, I will solve a `Carrom` CSS Challenge on CSS Battle.

Jatin Sharma
Jatin Sharma

Jun 25, 2022

1 min read·196 words

In this article, I will solve a Carrom 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: Simply Square

Solution

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

HTML

First, create an HTML for this, I've used the two containers to do that. you can use Pseudo-classes as well.

index.html
<div class="box">
  <span></span>
  <span></span>
  <span></span>
  <span></span>
</div>
<div class="box">
  <span></span>
  <span></span>
  <span></span>
  <span></span>
</div>

CSS

Now let's style the containers.

styles.css
body {
  margin: 0;
}
.box {
  display: flex;
  flex-wrap: wrap;
  column-gap: 100px;
  background: #62374e;
}
.box span {
  width: 50px;
  height: 50px;
  background: #fdc57b;
  align-self: center;
  margin: 50px;
}
body {
  margin: 0;
}
.box {
  display: flex;
  flex-wrap: wrap;
  column-gap: 100px;
  background: #62374e;
}
.box span {
  width: 50px;
  height: 50px;
  background: #fdc57b;
  align-self: center;
  margin: 50px;
}
Tip

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

Wrapping up

If you like this then don't forget to ❤️ it. And I'll see you in the next article. See you soon.