Photo rail
A full-width sideways strip of photo tiles with short captions. Gradient tiles stand in until you add pictures. Swipe or scroll on any screen, with the strip bleeding off the page edge. Use it for a gallery, places, team or process photos. It adds visual rhythm between text sections and needs no JavaScript.
<section class="blk-section" aria-labelledby="blk-photos-title">
<div class="blk-container">
<header class="blk-head">
<div class="blk-head__main">
<h2 id="blk-photos-title">A look around</h2>
<p>Scroll through a few moments from our work and our place.</p>
</div>
</header>
</div>
<ul class="blk-photos" tabindex="0" aria-label="Photo gallery, scroll sideways">
<li><figure class="blk-photo blk-photo--1"><figcaption>Our office</figcaption></figure></li>
<li><figure class="blk-photo blk-photo--2"><figcaption>Client workshop</figcaption></figure></li>
<li><figure class="blk-photo blk-photo--3"><figcaption>The team</figcaption></figure></li>
<li><figure class="blk-photo blk-photo--4"><figcaption>On site</figcaption></figure></li>
<li><figure class="blk-photo blk-photo--1"><figcaption>Planning session</figcaption></figure></li>
<li><figure class="blk-photo blk-photo--2"><figcaption>Reviewing results</figcaption></figure></li>
</ul>
</section>.blk-photos { list-style: none; display: flex; gap: 12px; margin: 0; padding: 4px 24px 14px; overflow-x: auto; scroll-snap-type: x mandatory; scroll-padding-inline: 24px; scrollbar-color: var(--blk-accent) transparent; }
.blk-photos:focus-visible { outline: 3px solid var(--blk-accent); outline-offset: -3px; }
.blk-photos > li { flex: 0 0 78%; max-width: 340px; scroll-snap-align: start; }
.blk-photo { position: relative; isolation: isolate; display: flex; align-items: flex-end; height: 340px; margin: 0; overflow: hidden; border-radius: var(--blk-radius-lg); color: var(--blk-on-dark); background: linear-gradient(150deg, var(--blk-panel-1), var(--blk-deep)); }
.blk-photo--1 { background: linear-gradient(150deg, var(--blk-panel-1), var(--blk-deep)); }
.blk-photo--2 { background: linear-gradient(150deg, var(--blk-panel-2), var(--blk-deep)); }
.blk-photo--3 { background: linear-gradient(150deg, var(--blk-panel-3), var(--blk-deep)); }
.blk-photo--4 { background: linear-gradient(150deg, var(--blk-panel-4), var(--blk-deep)); }
.blk-photo > img { position: absolute; inset: 0; width: 100%; height: 100%; object-fit: cover; z-index: -2; transition: transform .5s ease; }
.blk-photo::before { content: ""; position: absolute; inset: 0; z-index: -1; background: linear-gradient(0deg, rgba(8,13,19,.8) 0%, rgba(8,13,19,0) 55%); }
.blk-photo figcaption { padding: 18px 20px; font-family: var(--blk-font-heading); font-weight: 500; font-size: .95rem; }
.blk-photo:hover > img { transform: scale(1.05); }
@media (min-width: 900px) {
.blk-photos { padding-inline: max(24px, calc((100vw - var(--blk-container)) / 2 + 24px)); scroll-padding-inline: max(24px, calc((100vw - var(--blk-container)) / 2 + 24px)); }
.blk-photos > li { flex-basis: 280px; }
}
@media (prefers-reduced-motion: reduce) { .blk-photo:hover > img { transform: none; } }How to customise it
- For photos, add
<img src="..." alt="A useful description">as the first child of each<figure>. Add real alt text, oralt=""if the caption already says it. - Keep captions to a few words. They sit over a dark fade at the bottom of each tile.
- Add as many tiles as you like. The strip scrolls and snaps; on desktop about four show at once.
- Tile colours cycle through
--blk-panel-1to--blk-panel-4.
Tokens it reads
--blk-bg--blk-panel-1--blk-panel-2--blk-panel-3--blk-panel-4--blk-on-dark--blk-accent--blk-radius-lg--blk-font-headingAdd the "Photo rail" block from Product Scope Blocks (https://resources.productscope.uk/blocks/blocks/photo-rail) to my page. Link https://resources.productscope.uk/blocks/blocks/kit/blocks.css once. Paste the HTML from https://resources.productscope.uk/blocks/blocks/kit/blocks/photo-rail.html and replace the placeholder text with my real content. Do not change the class names, add inline styles or add scripts. To change colours or fonts, override the --blk- variables in my own CSS. Do not invent facts, clients or numbers.