CSS Battle: #9 - Tesseract

Jatin Sharma

Jatin SharmaJuly 23, 2022

2 min read255 words

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

index.html

<div class="rect"></div>
<div class="square"></div>
<div class="circle"></div>

CSS

styles.css

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;
}
Tip #1

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.

Tip #2

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 you can extend your support by Buying me a Coffee

Jatin's Newsletter

Get notified in your inbox whenever I write a new blog post.

Share on Social Media: