Creating the JAMstack logo with CSS - A Step-By-Step Guide

Braydon Coyer

Braydon Coyer / April 16, 2021

4 minute read

--- views
Cover

In this brief tutorial, you’ll learn how to create the JAMstack logo from scratch with CSS!

Here’s a pen showing the final result!

Thinking in shapes & setting up our variables

At first glance, this logo may look complex but it can actually be recreated with a few divs (it could probably be done with a single div, but that’s another article for another day). When considering how to tackle a piece like this, it's best to break it up into shapes. What shapes do you see in this logo? I see a circle and several squares.

JAMstackLogoDeconstruction-01.jpeg

Now that the seemingly complex logo has been broken down into shapes, we can start to build each part individually.

I’ll be using SCSS for this tutorial, but you can use vanilla CSS if you’d like. While you won’t get the class-nesting, you can still use CSS Variables.

At the top of our style file, let’s define the following variables. These will be used for colors and sizes throughout this tutorial.

1$jam: #f0047f;
2$white: white;
3$logo-size: 24rem;
4$inner-square-size: 9rem;

The logo shell

We can’t style elements that don’t exist. Let’s first work on, arguably, the most complex shape in this tutorial — the pink JAMstack logo.

1<div class="jam__circle"></div>

This shape looks complex. It’s a circle, but has a corner in the top-right portion. I’ll admit - when I was considering how to achieve a shape like this, I was originally going to make this two separate shapes: the circle, and a square that would sit in the top-right corner.

You, too, may think that’s the best way forward, but that’s actually overcomplicating it.

Instead of creating two separate divs, we can recreate this shape with a few lines of CSS. Let’s take a look!

1.jam__circle {
2 position: relative;
3 width: $logo-size;
4 height: $logo-size;
5 background: $jam;
6 border-radius: 100%;
7 border-top-right-radius: 0;
8}

Do you see the secret? That's right - the key is in the border-radius.

We achieve the circle by setting the border-radius to 100% (you're no doubt familiar with this), but did you know you can control the border-radius of each corner? Yes!

The last line of CSS sets the top-right border-radius to 0, creating a smooth transition from circle to a pointed corner in that quadrant of the element. Pretty cool, right?

Screen Shot 2021-04-15 at 9.09.29 AM.jpeg

The inner squares

The inner squares require a bit more CSS, but from here on out, things are pretty straightforward!

Open the div we created earlier and add the following markup.

1<div class="jam__circle">
2 <div class="jam__squares">
3 <div class="jam__squares-top">
4 <div class="jam__squares-top-right"></div>
5 </div>
6 <div class="jam__squares-bottom">
7 <div class="jam__squares-bottom-left"></div>
8 <div class="jam__squares-bottom-right"></div>
9 </div>
10 </div>
11</div>

Let's first target the .jam__squares element and center it inside our JAMstack logo.

1.jam__squares {
2 position: absolute;
3 left: 50%;
4 top: 50%;
5 transform: translate(-50%, -50%);
6}

Next, let's give the squares a width and height so we can see them on the screen.

1.jam__squares {
2 /* other styles */
3
4 &-top {
5 &-right {
6 width: $inner-square-size;
7 height: $inner-square-size;
8 background: $white;
9 }
10 }
11
12 &-bottom {
13 &-left {
14 width: $inner-square-size;
15 height: $inner-square-size;
16 background: $white;
17 }
18
19 &-right {
20 width: $inner-square-size;
21 height: $inner-square-size;
22 background: $white;
23 }
24 }
25}

Because we’re using SCSS, the class name nesting comes in handy and makes it easier to see which styles are associated with which elements.

Screen Shot 2021-04-15 at 9.34.05 AM.jpeg

The squares show up, but they certainly aren’t positioned correctly.

We can take a giant leap towards the desired look if we target the &-bottom nested class and turn it into a flex element.

1...
2 &-bottom {
3 display: flex;
4
5 &-left {
6 ...
7 }
8
9 }
10...

With that single change, our piece is starting to take form.

Screen Shot 2021-04-15 at 9.37.05 AM.jpeg

The top square is sitting on the left instead of the right-side of our logo. Let’s fix that and add a bit of bottom-margin, creating a gap between the top and bottom squares.

1/* other styles */
2
3 &-top {
4 display: flex;
5 justify-content: flex-end;
6 margin-bottom: 0.8rem;
7
8 &-right {
9 ...;
10 }
11}

Screen Shot 2021-04-15 at 9.39.34 AM.jpeg

You may be wondering how we'll achieve that rounded look on the bottom squares. If you're thinking we can use the same border-radius trick we used earlier, you're right!

1&-left {
2 ...
3 border-bottom-left-radius: 10rem;
4}
5
6&-right {
7 ...
8 border-bottom-right-radius: 10rem;
9}

Screen Shot 2021-04-15 at 9.43.04 AM.jpeg

We’re almost there! All we need to do is make a bit of a gap between the bottom squares. That’s easy enough.

1&-left {
2 ...
3 margin-right: 0.8rem;
4}

Screen Shot 2021-04-15 at 9.44.38 AM.jpeg

Conclusion

And there we go! CSS Art is always so much fun to make and it's a great way to challenge yourself and learn new things. Don’t forget, break things down into simple shapes and create a game-plan for the project. Once those shapes are defined, the rest will usually fall into place.

Thanks for reading! If you liked this article and want more content like this, read some of my other articles , subscribe to my newsletter and make sure to follow me on Twitter!

Articles delivered to your inbox!

A periodic update about my life, recent blog posts, how-tos, and discoveries.

As a thank you, I'll also send you a FREE CSS tutorial!

No spam - unsubscribe at any time!