Jatin Sharma
Jatin's Blog


Jatin's Blog

CSS Battle: #13 - Totally Triangle

CSS Battle: #13 - Totally Triangle

Jatin Sharma's photo
Jatin Sharma
·Aug 9, 2022·

2 min read

Play this article

In this article, I will solve a Totally Triangle CSS Challenge on CSS Battle. Let's look at the problem first.


We need to create the following container by using CSS Properties only: Totally Triangle


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




Now let's style the containers.

* {
  margin: 0;
  background: #0b2429;
p {
  position: fixed;
  width: 200;
  height: 200;
  background: #f3ac3c;
  transform: rotate(45deg);
  left: -100;
  top: -100;

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.

Minified Version:


Alternative Method


body {
  background: linear-gradient(135deg, #f3ac3c 100px, #0b2429 100px);

You can achieve this by using linear-gradient() also which is a lot simpler. You don't even need HTML in this.

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.

Share this