CSS Battle: #9 - Tesseract

j471n

Jatin Sharma

Posted on July 23, 2022

CSS Battle: #9 - Tesseract

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

Solution

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

HTML

<div class="rect"></div>
<div class="square"></div>
<div class="circle"></div>
Enter fullscreen mode Exit fullscreen mode

CSS

Now let's style the containers.

body {
  margin: 0;
  background: #222730;
  display: grid;
  place-items: center;
}
.rect {
  width: 100%;
  height: 150px;
  background: #4caab3;
}
.square {
  position: absolute;
  width: 150px;
  height: 150px;
  background: #4caab3;
  transform: rotate(45deg);
  box-shadow: 0 0 0 50px #222730;
}
.circle {
  position: absolute;
  width: 50px;
  height: 50px;
  background: #393e46;
  border-radius: 50px;
}
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.

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.

💖 💪 🙅 🚩
j471n
Jatin Sharma

Posted on July 23, 2022

Join Our Newsletter. No Spam, Only the good stuff.

Sign up to receive the latest update from our blog.

Related