Create Beautiful Images in CSS to Buff Up Your Portfolio
Many people build weather apps to show off their new skills. Don’t let yours be boring
Nowadays, it’s hard to get your first job without impressing somebody with your portfolio. Everybody is creating weather apps, but does everybody have custom CSS-based images in theirs? Let’s create unique images to boost your portfolio.
There are multiple shapes that we can create in CSS, so why not create custom CSS images instead of stock photos? These will cut some unnecessary requests and speed up your website; moreover, they allow you to bring some life to your site.
I don’t want to create the entire app here, only images that you can use to build one. It may look like you put in a lot of effort to tweak the app, but you didn’t.
Exercise 1. First-Ever CSS Cloud
Let’s start with a simple cloud. This cloud is made with one rectangle and two circles. You can use three divs, but I prefer to minimalize HTML as much as I can. That’s why I use one div for the rectangle and two pseudo-elements to create the circles.
This is really easy.
Now we need to change the background of our circles and move them closer to the rectangle.
Voilà! The first cloud created!
Exercise 2. Magical Cloud
This cloud is unusual. It’s created with one rectangle and three squares: one div, two pseudo-elements, and one span.
We have the same situation as in the first cloud. We need to slide the elements together and change the background to white.
Exercise 3. Weather Images
Let’s get our hands dirty. We will create two images: a basic sunny cloud and a stormy, evil one. But don’t worry, it’s simple.
All images are based on this article.
First we need to create a few components.
Our base colour component is created similar to the way we did the first one.
Cloud shadow
To create shadow, we need to duplicate our cloud with additional blur, colour it blue, and scale it down.
Step by step:
- Duplicate the cloud with a blue colour.
- Add blur.
- Scale it down — transform: scale(0.8).
- Add pseudo-elements — two white circles to mask our shadow.
Sun image
This is pretty simple: a circle with a shadow and a pseudo-element background to lighten our sun.
Cloud and sun
Now we have to combine the sun, the cloud, and some additional sun flashes.
And that’s it!
You can play with the sunny cloud on CodePen.
As you can see, creating this image took us only a few minutes of work. Moreover, creating another image based on this one can be even faster. So let’s do this!
Lightning bolt
First of all, let’s create a lightning bolt shape by merging two triangles. Now use two triangles and animate the shape with CSS.
Storm cloud
Okay! Let’s finish our cloud by combining our basic cloud (with grey background), the lightning, and some CSS for wind and water drops.
You can play with the storm cloud on CodePen.
Homework
Now you know how to create awesome weather images, so create your own! Snow? Blizzard? Fog, maybe?
Thanks for reading!