Code Snippet
Before we all had cameras in our phones, people could take a Polaroid® photo which would print directly from the camera, and had a unique, framed look.
This framed look can be used to show photos in an interesting way on certain sites, such as a vacation sites, zoo sites, or photo-oriented sites just to name a few.
HTML
<figure class="polaroid">
<img decoding="async" src="/images/fantasy-beach.jpg" alt="Fantasy Beach" />
<figcaption class="polaroid_title">Fantasy Beach</figcaption>
</figure>
CSS
figure.polaroid {
background-color: white;
border: #ffffff solid 10px;
border-top-width: 14px;
box-shadow: 4px 4px 8px 2px rgba(0, 0, 0, 0.2);
transform: rotate(1deg);
}
figure.polaroid img {
width: 100%;
}
figcaption.polaroid_title {
text-align: center;
padding: 25px 20px 1%;
}
Example
CSS Notes:
- The “inherit”, “initial” and “unset” keywords can be used with any CSS property to set its value
- In CSS there are many ways to express a color value in a property
We’d like to acknowledge that we learned a great deal of our coding from W3Schools and TutorialsPoint, borrowing heavily from their teaching process and excellent code examples. We highly recommend both sites to deepen your experience, and further your coding journey. We’re just hitting the basics here at 1SMARTchicken.