# Skeleton Image

> An image placeholder that keeps its aspect ratio and shows a photo icon under a diagonal shimmer.

- Category: [CSS Loaders & Spinners](https://copy-css.com/category/loaders)
- Tags: placeholder, photo, aspect-ratio, lazy loading, shimmer
- Live preview: https://copy-css.com/snippets/skeleton-image
- License: Free for personal and commercial use. No signup, no attribution required.

## HTML

```html
<div class="skel-image" role="status" aria-label="Loading image"></div>
```

## CSS

```css
.skel-image {
  position: relative;
  width: min(100%, 280px);
  aspect-ratio: 4 / 3;
  overflow: hidden;
  border-radius: 14px;
  background: #e5e7eb;
}

/* Photo icon */
.skel-image::before {
  content: "";
  position: absolute;
  inset: 0;
  width: 48px;
  height: 48px;
  margin: auto;
  background: #cbd5e1;
  -webkit-mask: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='%23000' stroke-width='2' stroke-linecap='round' stroke-linejoin='round'%3E%3Crect x='3' y='3' width='18' height='18' rx='2'/%3E%3Ccircle cx='9' cy='9' r='2'/%3E%3Cpath d='m21 15-3.1-3.1a2 2 0 0 0-2.8 0L6 21'/%3E%3C/svg%3E") center / contain no-repeat;
  mask: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='%23000' stroke-width='2' stroke-linecap='round' stroke-linejoin='round'%3E%3Crect x='3' y='3' width='18' height='18' rx='2'/%3E%3Ccircle cx='9' cy='9' r='2'/%3E%3Cpath d='m21 15-3.1-3.1a2 2 0 0 0-2.8 0L6 21'/%3E%3C/svg%3E") center / contain no-repeat;
}

.skel-image::after {
  content: "";
  position: absolute;
  inset: 0;
  background: linear-gradient(120deg, #fff0 30%, #ffffff99 50%, #fff0 70%) 0 0 / 250% 100%;
  animation: skel-image-shine 1.8s ease-in-out infinite;
}

@keyframes skel-image-shine {
  from { background-position: 100% 0; }
  to { background-position: 0 0; }
}

@media (prefers-reduced-motion: reduce) {
  .skel-image::after { animation: none; }
}
```

## Notes

- This CSS Skeleton Image is 38 lines of pure CSS (1.4 KB) with no JavaScript and no dependencies. It uses keyframe animations, linear gradients, masks and aspect-ratio.
- In JSX use `className` instead of `class`. In Tailwind projects put the CSS in the global stylesheet.
