Inset Image Matte
Inset margins frame a gallery image and bring a title panel into focus.
Inset margins frame a gallery image and bring a title panel into focus.
Live Demo
Hover over the element or use Tab to focus.
Source Code
Copy the HTML, CSS or JavaScript you need for your project.
<a class="tbx-1076" href="#gallery" aria-label="View seaside exhibition project"><span class="tbx-1076__visual" aria-hidden="true"><span class="tbx-1076__sun"></span><span class="tbx-1076__horizon"></span><span class="tbx-1076__boat"></span></span><span class="tbx-1076__label"><small>COLLECTION / 08</small><b>SEA STUDIES</b><span>View the gallery ↗</span></span></a>
.tbx-1076{position:relative;display:block;width:min(282px,100%);height:186px;overflow:hidden;background:#e9f0e9;text-decoration:none;color:white;font:12px/1.4 system-ui,sans-serif}
.tbx-1076__visual{position:absolute;inset:0;background:linear-gradient(#a8c8c9 0 53%,#548e9c 54% 70%,#285e75 71%);transition:inset .38s,filter .38s}
.tbx-1076__sun{position:absolute;width:47px;height:47px;top:25px;right:55px;background:#ffd99a;border-radius:50%}
.tbx-1076__horizon{position:absolute;left:0;right:0;top:56%;height:2px;background:#e3e9d8aa}.tbx-1076__boat{position:absolute;bottom:30px;left:72px;width:122px;height:18px;background:#1c475d;clip-path:polygon(0 0,100% 0,81% 100%,14% 100%)}
.tbx-1076__boat:before{content:"";position:absolute;bottom:12px;left:50px;border:20px solid transparent;border-right:2px solid #eee}
.tbx-1076__label{position:absolute;inset:0;display:flex;align-items:center;justify-content:center;flex-direction:column;gap:7px;background:#0d273865;opacity:0;transition:opacity .32s}
.tbx-1076__label small{font-size:9px;letter-spacing:.13em}.tbx-1076__label b{font-size:21px;letter-spacing:.07em}.tbx-1076__label span{font-size:10px;border-bottom:1px solid currentColor;padding-bottom:3px}
.tbx-1076:is(:hover,:focus-visible) .tbx-1076__visual{inset:13px;filter:saturate(.72)}.tbx-1076:is(:hover,:focus-visible) .tbx-1076__label{opacity:1;inset:13px}
.tbx-1076:focus-visible{outline:3px solid #ceac74;outline-offset:3px}
@media(prefers-reduced-motion:reduce){.tbx-1076 *{transition:none!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 image galleries and portfolio 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.