How to Create a Polaroid Picture with CSS πΈ

Welcome to my blog ππ½
I'm a Front-End Developer with a passion for learning!
I write about Programming π©π½βπ» and Productivity Tips β
Search for a command to run...

Welcome to my blog ππ½
I'm a Front-End Developer with a passion for learning!
I write about Programming π©π½βπ» and Productivity Tips β
Although my experience is primarily with front-end development, my current job is affording me the opportunity to do more full-stack work. Naturally, this meant that I needed to explore the different database GUIs available on the market. Here is a l...

A Note on the Series: Fast Fridays π is a series where you will find fast, short, and sweet tips/hacks that you may or may not be aware of. I will try to provide these (fairly) regularly on Fridays. In this Fast Friday tip, I'll explain how to crea...

Over the past year, Iβve started incorporating a Git GUI into my workflow. I still reach for the terminal about 90% of the time, but Iβve found that a GUI can really shine when it comes to things like viewing diffs, checking stashes, or resolving mer...

Simplifying Branch Management with Git Worktree

With all the AI tools popping up these days, I figured I'd try out some speech-to-text software in an attempt to boost my productivity. I've been hearing a lot about βdeveloping at the speed of thoughtβ, so here's a list of the top speech-to-text sof...

Whenever I think of the words "polaroid picture," I can't help but think of OutKast's "Hey Ya" π΅. However, along with reminding me of a catchy song, I also like the nostalgic and retro look that polaroid pictures provide. In this post, I'll show you how to produce this effect using CSS.
In order to achieve this effect, we need these three semantic elements :
<figure> <img><figcaption> (optional)<figure> element. This is optional because you can omit this if you don't want the picture to have a caption displayed underneath the image.Pairing the three elements together, you will have something that looks like this:
<figure class="polaroid">
<img
src="images/grace-maher-lH3GNpsRsnU-unsplash.jpg"
alt="Polaroid Picture"
/>
<figcaption>Polaroids are Cool π</figcaption>
</figure>
The first thing we want to do is create a .polaroid class and add it to the <figure> tag. This class will have three CSS properties:
background-color set to white.padding: 1rem 1rem 4rem 1rem to the top, left, and right of the <figcaption> and 4rem of padding at the bottom of the container to give it the vintage polaroid look.box-shadow to add some depth to the overall container.Then we set a fixed width on the <img> tag. Lastly, apply a text color and center the legend within the <figcaption>.
.polaroid {
background-color: #fff;
padding: 1rem 1rem 4rem;
box-shadow: 5px 7px 4px #888888;
}
img {
width: 19rem;
}
figcaption {
color: #000;
text-align: center;
}
Voila! β¨ After combining the HTML and CSS you can get a funky and retro result that looks like the CodeSandbox below:
ππ½ As always, thank you for reading and happy coding!
[Photo by Denise Jans on Unsplash]