CSS: Creating a polaroid-style image using CSS

Polaroid is quite an iconic brand, and instantly recognisable for its retro look.  In this simple tutorial, I will explain how to create a polaroid-style effect for photographs on your pages.

First of all, let’s create a simple html page which contains a header and the image we want to use.  My starting html looks like this:-

<!DOCTYPE html>
<html>
   <head>
      <title>Polaroid effect in CSS</title>
      <link rel="stylesheet" href="pol-style.css" />
   </head>
<body>
      <h1>Polaroid-style border effect using CSS</h1>
      <div class="polaroid">
          <img src="polaroid-images/doggie.jpg" />
          <h2>This is my dog</h2>
      </div>
</body>
</html>

It’s a fairly simple html file, with a link to a stylesheet and an image in separate folders for the project.  I’ve created a div with class name of ‘polaroid’, which will be used to style the image to make it look like a polaroid.  As far as HTML goes, that’s it.  The rest of the work will be done with the CSS.

So far then, we have this:-

polaroid-initial

Nothing much to get excited about, really, apart from the dog (which isn’t mine, by the way – I got the image from here).

Right, then.  So, how do we make the image look like a polaroid?  Here’s the CSS I used:-

body {
    background-image: url(polaroid-images/dark-noise-1.png);
    font-family: arial;
}

h1{
    color: white;
}

h2 {
    color: black;
    text-align: center;
    margin: 10px;
    font-weight: normal;
}

.polaroid {
    background-color: white;
    display: inline-block;
    padding: 20px 20px 0 20px;
    box-shadow: 10px 10px 5px Black;
    transform:rotate(4deg);
    -ms-transform:rotate(4deg);
    -webkit-transform:rotate(4deg);
    -moz-transform:rotate(4deg);
}

And the page now looks like this:-

polaroid-finished

There’s a lot more we could do to this, but I wanted to keep things simple.
The finished product can also be viewed here.

Leave a Reply

Your email address will not be published. Required fields are marked *