DEV Community

Cover image for CSS Logos: Slack logo
Chris Bongers
Chris Bongers

Posted on β€’ Edited on β€’ Originally published at daily-dev-tips.com

24 8

CSS Logos: Slack logo

In this article, I wanted to look at the slack logo, I had this logo in my head for the past couple of days, and this is quite an interesting one as it's one of the views that work well for a grid-based layout.

This is the logo I'm talking about:

Slack Logo

Analysing the logo

As you might have seen, this logo can easily be broken up into squares, where some of the elements span over two of them.

Here is a screenshot of the finished product with the grid active.

Slack logo in a grid

We can set up a grid and use some generic styles to re-use some of the elements' layouts.

Let's get right into it and see how this works.

Creating the Slack logo in CSS Grid

.slack {
  width: 16rem;
  aspect-ratio: 1;
  display: grid;
  grid-template-rows: repeat(4, minmax(0, 1fr));
  grid-template-columns: repeat(4, minmax(0, 1fr));
}
Enter fullscreen mode Exit fullscreen mode

This will create the primary grid that we can start filling up with our pieces.

Empty grid

Let's get started on the top left blue item section first.

In our HTML, we can add the following elements.

<div class="slack">
  <div class="blue small"></div>
  <div class="blue big"></div>
</div>
Enter fullscreen mode Exit fullscreen mode

Since every pill is rounded technically, we can add that as one styling element for all divs.

.slack {
  & > div {
    border-radius: 9999px;
  }
}
Enter fullscreen mode Exit fullscreen mode

Note: The above and some code below will be SCSS code

Then we can start positioning our elements on the grid. The simplest one here is the bottom one, as that should span over two columns and sit on the second row.

.blue {
  background: #36c5f0;
  &.big {
    grid-row: 2;
    grid-column: span 2;
  }
}
Enter fullscreen mode Exit fullscreen mode

As you can see, we set this element to be on row two and span over two columns.

We can do something similar for the small one, but not round the bottom right corner.

.blue {
  &.small {
    grid-column-start: 2;
    border-bottom-right-radius: 0px;
  }
}
Enter fullscreen mode Exit fullscreen mode

So far, we should have the following look:

Slack top left item

But, we can quickly see it's too smooshed together, so let's add a gap to our grid.

.slack {
  gap: 0.5rem;
}
Enter fullscreen mode Exit fullscreen mode

Now we can add the other three sides and position them accordingly. The main thing that changes is the column/row start and end and which border we turn off.

<div class="slack">
  <div class="blue small"></div>
  <div class="blue big"></div>
  <div class="green small"></div>
  <div class="green big"></div>
  <div class="red small"></div>
  <div class="red big"></div>
  <div class="yellow small"></div>
  <div class="yellow big"></div>
</div>
Enter fullscreen mode Exit fullscreen mode

And for the CSS dump, please check this CodePen to see what's happening.

Do note there are multiple correct ways of determining the column/row start and end.

Thank you for reading, and let's connect!

Thank you for reading my blog. Feel free to subscribe to my email newsletter and connect on Facebook or Twitter

Sentry blog image

How to reduce TTFB

In the past few years in the web dev world, we’ve seen a significant push towards rendering our websites on the server. Doing so is better for SEO and performs better on low-powered devices, but one thing we had to sacrifice is TTFB.

In this article, we’ll see how we can identify what makes our TTFB high so we can fix it.

Read more

Top comments (4)

Collapse
 
svgatorapp profile image
SVGator β€’

Quick and easy πŸ™Œ

Collapse
 
renanfranca profile image
Renan Franca β€’

So far this is the best "breakdown of the complexity into simple parts process" from that series πŸ‘

Collapse
 
dailydevtips1 profile image
Chris Bongers β€’

Thanks! Improving as we go 🀘

Collapse
 
theabhayprajapati profile image
Abhay Prajapati β€’

so osmπŸ˜‡

Sentry image

See why 4M developers consider Sentry, β€œnot bad.”

Fixing code doesn’t have to be the worst part of your day. Learn how Sentry can help.

Learn more

πŸ‘‹ Kindness is contagious

Dive into an ocean of knowledge with this thought-provoking post, revered deeply within the supportive DEV Community. Developers of all levels are welcome to join and enhance our collective intelligence.

Saying a simple "thank you" can brighten someone's day. Share your gratitude in the comments below!

On DEV, sharing ideas eases our path and fortifies our community connections. Found this helpful? Sending a quick thanks to the author can be profoundly valued.

Okay