TipsBlocks Web Technique Library

PRACTICAL WEB TIP

← Back to library

Studio Contact Print

A darkroom-style contact-print border and exposure number appear around a photograph.

Live Demo

Hover over the element or use Tab to focus.

Source Code

Copy the HTML, CSS or JavaScript you need for your project.

HTML
<div class="tbx-1257"><button class="photo" type="button" aria-label="Show image capture details"><span class="land"><i class="sun"></i><i class="ridge one"></i><i class="ridge two"></i></span><span class="film" aria-hidden="true"><span class="perfs">··············</span><span class="lower">FRAME 008 / EDITION 01</span></span></button></div>
CSS
.tbx-1257{box-sizing:border-box;display:flex;align-items:center;justify-content:center;width:100%;max-width:100%;min-height:218px;overflow:visible;padding:24px 18px;font-family:system-ui,-apple-system,"Segoe UI",sans-serif;color:#243e43}
.tbx-1257 *,.tbx-1257 *::before,.tbx-1257 *::after{box-sizing:border-box}
.tbx-1257{background:#dce5e1}
.tbx-1257 .photo{border:0;position:relative;width:min(286px,100%);aspect-ratio:1.65;background:#1c292c;overflow:hidden;cursor:pointer;padding:0;box-shadow:0 12px 25px #233f4030}
.tbx-1257 .land{position:absolute;inset:0;background:linear-gradient(160deg,#8db7ad,#4f8296 51%,#314c5a);transition:inset .52s cubic-bezier(.2,.8,.2,1),filter .5s}
.tbx-1257 .sun{position:absolute;right:43px;top:24px;width:43px;height:43px;border-radius:50%;background:#fff0bd}
.tbx-1257 .ridge{position:absolute;bottom:-42%;width:85%;height:85%;transform:rotate(45deg);background:#24526b}
.tbx-1257 .one{left:-15%}
.tbx-1257 .two{right:-34%;bottom:-54%;background:#19364b}
.tbx-1257 .film{position:absolute;inset:0;color:white;pointer-events:none}
.tbx-1257 .perfs{position:absolute;top:3px;left:6px;color:#d7d2bb;letter-spacing:5px;font-size:9px;opacity:0;transition:opacity .3s}
.tbx-1257 .lower{position:absolute;bottom:7px;left:16px;font-size:9px;font-weight:650;letter-spacing:.15em;opacity:0;transform:translateY(9px);transition:opacity .34s,transform .34s}
.tbx-1257 .photo:is(:hover,:focus-visible) .land{inset:12px 12px 28px;filter:saturate(.75)}
.tbx-1257 .photo:is(:hover,:focus-visible) .perfs,.tbx-1257 .photo:is(:hover,:focus-visible) .lower{opacity:1;transform:none}
@media (prefers-reduced-motion: reduce) {.tbx-1257 *, .tbx-1257 *::before, .tbx-1257 *::after { transition-duration:0.01ms !important; animation-duration:0.01ms !important; scroll-behavior:auto !important; } }

How to Use

Insert the HTML and add the CSS to your stylesheet. Adjust colors and sizes and avoid class conflicts.

Use Case

Useful for portfolio galleries and image galleries.

Technical Notes

Keep controls usable on touch devices. Test keyboard focus and reduced-motion preferences.

Mobile:Ensure the interactive content remains accessible without hover on touch devices.

Browser:Uses modern CSS. Check behavior in the browsers you support.

Reduced Motion:Check that prefers-reduced-motion is respected.