01Even 2-column grid
Four photos sit in an even 2×2 grid, and only the tile under the cursor lifts slightly with a deeper shadow to mark which one you're looking at.
Best forA 4-6 photo portfolio thumbnail row, photo groups inside a blog post
grid-template-columns:repeat(2,1fr)gaptranslateY hover

<main class="stage">
<ul class="gallery is-demo" aria-label="Photo gallery">
<li class="tile" tabindex="0"></li>
<li class="tile" tabindex="0"></li>
<li class="tile" tabindex="0"></li>
<li class="tile" tabindex="0"></li>
</ul>
</main>@use "../../../../site/static/demo-tokens" as *;
$duration: $dur-quick; // 타일이 뜨는 시간
$easing: $ease-out;
$color: $subject-blue; // 타일 그러데이션
@include stage($stage-ink);
.stage { padding: clamp(8px, 2.4vw, 16px); }
.gallery {
display: grid;
grid-template-columns: repeat(2, 1fr);
gap: $sp-2;
list-style: none;
margin: 0;
padding: 0;
width: 188px;
max-width: 100%;
}
.tile {
aspect-ratio: 4 / 3;
border-radius: $r-sm;
outline: none;
cursor: pointer;
box-shadow: $shadow-press;
transition: transform $duration $easing, box-shadow $duration $easing;
}
.tile:nth-child(1) { background: linear-gradient(155deg, $color 0%, $stage-ink 100%); }
.tile:nth-child(2) { background: linear-gradient(205deg, $subject-cream 0%, $color 100%); }
.tile:nth-child(3) { background: linear-gradient(115deg, $color 0%, $subject-cream 60%); }
.tile:nth-child(4) { background: linear-gradient(250deg, $stage-ink 0%, $color 100%); }
.tile:hover, .tile:focus-visible, .tile:active {
transform: translateY(-4px) scale(1.03);
box-shadow: $shadow-raised;
}
.gallery.is-demo .tile { animation: lift-loop $dur-loop $easing infinite; }
.gallery.is-demo .tile:nth-child(2) { animation-delay: -0.5s; }
.gallery.is-demo .tile:nth-child(3) { animation-delay: -1.0s; }
.gallery.is-demo .tile:nth-child(4) { animation-delay: -1.5s; }
@keyframes lift-loop {
0%, 10% { transform: translateY(0) scale(1); box-shadow: $shadow-press; }
25%, 35% { transform: translateY(-4px) scale(1.03); box-shadow: $shadow-raised; }
50%, 100% { transform: translateY(0) scale(1); box-shadow: $shadow-press; }
}
@media (hover: none) {
.tile:active { transform: translateY(-4px) scale(1.03); box-shadow: $shadow-raised; }
}
@media (prefers-reduced-motion: reduce) {
.tile { transition: none; }
.gallery.is-demo .tile { animation: none; }
}html, body {
margin: 0;
overflow: hidden;
}
.stage {
box-sizing: border-box;
min-height: 100vh;
display: grid;
place-items: center;
margin: 0;
background: #17141a;
font-family: -apple-system, "Segoe UI", "Noto Sans KR", sans-serif;
padding: clamp(8px, 4vw, 24px);
}
.stage {
padding: clamp(8px, 2.4vw, 16px);
}
.gallery {
display: grid;
grid-template-columns: repeat(2, 1fr);
gap: 8px;
list-style: none;
margin: 0;
padding: 0;
width: 188px;
max-width: 100%;
}
.tile {
aspect-ratio: 4/3;
border-radius: 8px;
outline: none;
cursor: pointer;
box-shadow: 0 6px 12px rgba(23, 20, 26, 0.32);
transition: transform 220ms ease-out, box-shadow 220ms ease-out;
}
.tile:nth-child(1) {
background: linear-gradient(155deg, #2f6df6 0%, #17141a 100%);
}
.tile:nth-child(2) {
background: linear-gradient(205deg, #fff7e6 0%, #2f6df6 100%);
}
.tile:nth-child(3) {
background: linear-gradient(115deg, #2f6df6 0%, #fff7e6 60%);
}
.tile:nth-child(4) {
background: linear-gradient(250deg, #17141a 0%, #2f6df6 100%);
}
.tile:hover, .tile:focus-visible, .tile:active {
transform: translateY(-4px) scale(1.03);
box-shadow: 0 14px 24px rgba(23, 20, 26, 0.32);
}
.gallery.is-demo .tile {
animation: lift-loop 2s ease-out infinite;
}
.gallery.is-demo .tile:nth-child(2) {
animation-delay: -0.5s;
}
.gallery.is-demo .tile:nth-child(3) {
animation-delay: -1s;
}
.gallery.is-demo .tile:nth-child(4) {
animation-delay: -1.5s;
}
@keyframes lift-loop {
0%, 10% {
transform: translateY(0) scale(1);
box-shadow: 0 6px 12px rgba(23, 20, 26, 0.32);
}
25%, 35% {
transform: translateY(-4px) scale(1.03);
box-shadow: 0 14px 24px rgba(23, 20, 26, 0.32);
}
50%, 100% {
transform: translateY(0) scale(1);
box-shadow: 0 6px 12px rgba(23, 20, 26, 0.32);
}
}
@media (hover: none) {
.tile:active {
transform: translateY(-4px) scale(1.03);
box-shadow: 0 14px 24px rgba(23, 20, 26, 0.32);
}
}
@media (prefers-reduced-motion: reduce) {
.tile {
transition: none;
}
.gallery.is-demo .tile {
animation: none;
}
}import type { CSSProperties } from "react";
import styles from "./TwoColGallery.module.scss";
export type TwoColGalleryProps = {
/** 타일이 뜨는 시간 (기본 220ms) */
duration?: number;
easing?: string;
/** 타일 그러데이션 색 */
color?: string;
};
type Vars = CSSProperties & { "--duration"?: string; "--easing"?: string; "--color"?: string };
/** 사진 4장을 2×2 칸에 나누고, 커서가 올라간 칸만 떠오르며 그림자가 짙어진다 */
export default function TwoColGallery({
duration = 220,
easing = "ease-out",
color = "#2f6df6",
}: TwoColGalleryProps) {
const vars: Vars = { "--duration": `${duration}ms`, "--easing": easing, "--color": color };
return (
<ul className={styles.gallery} style={vars} aria-label="Photo gallery">
{[0, 1, 2, 3].map((i) => (
<li key={i} className={`${styles.tile} ${styles["tile" + i]}`} tabIndex={0} />
))}
</ul>
);
}01 Even 2-column grid — Measured area 3.564% · moving frames 15/23Original by GODRICH · SCSS and React ship in the zip · 9 CSS Image Gallery Grid Effects
The post this demo lives in
9 CSS Image Gallery Grid EffectsCSS image gallery grid effects arrange photos into a grid or waterfall that reacts to hover and click, as pretty as the See all demos in this post
If you like this effect - similar demos
Galleries04 Video thumbnail grid with play overlayPortfolio Gallery HTML CSS: 9 UI Patterns
Galleries08 Lightbox slider opening from an album gridCSS Image Slider — 9 Responsive Sliders, No GSAP
Galleries01 Shortest-Column Packing That Drops Each Card on the Lowest ColumnCSS Masonry Layout: 9 Ways to Pack Uneven Cards