M4RKYU.SYSEdition 2027
Skip to content
LOCEN/Ontario · CA/▸logs · zero cls images in nextjs 16 lqip blur up done right 1nkbStandbyOK/--:--:--EST
M4M4RK_YUportfolio
  • BuildBuild
    BuildOverview
    • WorkSelected case studies and write-ups
    • GamesPlayable prototypes and game-dev logs
  • GalleryGallery
    GalleryOverview
    • PhotosPhoto collections and visual experiments
    • ShopPrints, posters, and one-off objects
  • WritingWriting
    WritingOverview
    • BlogLong-form devlogs and field notes
    • NotesShort observations, links, snippets
  • ResourcesResources
    ResourcesOverview
    • Tools38 in-browser developer utilities
    • LinksDaily-use dev and design bookmarks
  • AboutAbout
  • ContactContact
中文

syndicated · dev.to / @markyu

Next.js Images Without CLS: My LQIP Blur-Up Setup

A practical Next.js image optimization guide for zero CLS layouts, blur placeholders, dimensions, remote images, and production image hygiene.

Published
Jun 4
·
Reading time
2 min read
·
Reactions
6
nextjsperformancereactwebdev
View on dev.to

On this page

  • The Rule
  • Local Image Example
  • Remote Image Example
  • CSS Must Not Break the Ratio
  • Production Checklist
  • My Take on LQIP
  • Final Thought

Image layout shift is one of those bugs that makes a page feel cheap.

The content loads, the image arrives late, the text jumps, and the user loses their place.

In Next.js, the fix is not complicated: give the browser stable dimensions and use a placeholder only as polish, not as a layout crutch.

The Rule

No known image box -> layout shift risk
Known width/height -> stable layout
Blur placeholder -> nicer loading

Local Image Example

import Image from "next/image";
import hero from "@/public/hero.jpg";

export default function Hero() {
  return (
    <Image
      src={hero}
      alt="Dashboard showing image performance metrics"
      priority
      placeholder="blur"
      sizes="100vw"
      className="heroImage"
    />
  );
}

For static imports, Next.js can infer dimensions and generate blur data.

That is the easiest path.

Remote Image Example

Remote images need explicit dimensions:

<Image
  src="https://example.com/product.jpg"
  alt="Product preview"
  width={1200}
  height={800}
  placeholder="blur"
  blurDataURL={blurDataUrl}
  sizes="(max-width: 768px) 100vw, 720px"
/>

If you do not know the dimensions, fetch or store them before render. Guessing is how CLS sneaks back in.

CSS Must Not Break the Ratio

.heroImage {
  width: 100%;
  height: auto;
  object-fit: cover;
  border-radius: 12px;
}

Avoid setting random height without thinking about aspect ratio.

Production Checklist

CheckWhy
width and height setprevents layout shift
meaningful altaccessibility
sizes accurateavoids oversized downloads
priority only for heroavoids stealing bandwidth
blur placeholder smallavoids bloated HTML
remote domains configuredavoids runtime failures

My Take on LQIP

LQIP is not the main performance feature. It is a perceived performance feature.

The real layout fix is reserving the image box.

Blur-up makes the wait feel smoother, but it will not save a layout that does not know its own dimensions.

Final Thought

Zero CLS images are mostly discipline: dimensions, ratios, correct sizes, and not treating placeholders as magic.

What image bug has caused the most layout pain in your Next.js projects?

Related reading

React 19 Micro-Interactions Without Layout Jank

A practical React 19 micro-interactions guide focused on motion boundaries, CSS transitions, optimistic UI, reduced motion, and performance.

react

JavaScript Memory Leaks Usually Start With One Reference

A practical JavaScript memory guide covering stack, heap, garbage collection, closures, event listeners, timers, and leak debugging.

javascript

React Three Fiber: Build a 3D Scene Without Fighting React

A code-first React Three Fiber setup with lighting, controls, materials, and the mistakes that make your first scene render black.

react

originally published

This post first ran on dev.to. Comments and reactions live there.

Continue on dev.to
PreviousBad Data Quality Costs More Than a Slow QueryA practical data quality guide for engineers: validation, ownership, schema drift, observability, and fixing bad data before dashboards lie.
Back to all posts
NextFree 3D Asset Sites I’d Actually Use in a WebGL ProjectA practical 2026 guide to free 3D asset sources for games, Blender, and WebGL, with license checks, optimization tips, and production workflow advice.
Back to archive
M4RKYUM4RKYUM4RKYUM4RKYUM4RKYUM4RKYUM4RKYUM4RKYU
Crafted since 2024
ZhenXiao Mark YuZhenXiao Mark Yu
get in touch

Saw something here?Tell me about it.

It's a portfolio, not a service · but I read every note — drop a line if anything here resonated, or just to say hi.

Start a conversation
open channel

say hi anytime · 2026

--:--:--ESTOntario, Canada
  • Email
  • GitHub
  • dev.to
  • LinkedIn
  • Twitter / X
  • Instagram
  • Facebook
  • YouTube
  • CodePen
  • Spotify
  • Snapchat

Newsletter

Get the occasional dispatch

Notes and logs from m4rkyu.com — short, dated, no noise. Unsubscribe anytime.

Work

Production builds, games, and visual archives.

  • Projects
  • Games
  • Archive
  • Logs

Resources

Daily-use tools and a personal link library.

  • Search
  • Latest
  • Tools
  • Links
  • Notes
  • Topics
  • Shop
RSSJSON feed

Studio

Background, contact, and channels for collaboration.

  • About
  • Contact
  • Changelog
  • Colophon
  • Resumepending

Socials

Find me on the usual feeds.

  • GitHub
  • dev.to
  • LinkedIn
  • Twitter / X
  • Instagram
  • Facebook
  • YouTube
  • CodePen
  • Spotify
  • Snapchat
  • Email
© 2026 ZhenXiao Mark Yumarkyu0615@gmail.com
  • Email
  • GitHub
  • dev.to
  • LinkedIn
  • Twitter / X
  • Instagram
  • Facebook
  • YouTube
  • CodePen
  • Spotify
  • Snapchat
PrivacyTermsBuilt with Next.js 16 · React 19 · Tailwind 4