惯性聚合 高效追踪和阅读你感兴趣的博客、新闻、科技资讯
阅读原文 在惯性聚合中打开

推荐订阅源

量子位
奇客Solidot–传递最新科技情报
奇客Solidot–传递最新科技情报
博客园_首页
AWS News Blog
AWS News Blog
阮一峰的网络日志
阮一峰的网络日志
Vercel News
Vercel News
C
Cybersecurity and Infrastructure Security Agency CISA
P
Proofpoint News Feed
Exploit-DB.com RSS Feed
Exploit-DB.com RSS Feed
T
Tailwind CSS Blog
PCI Perspectives
PCI Perspectives
Application and Cybersecurity Blog
Application and Cybersecurity Blog
博客园 - 叶小钗
IT之家
IT之家
V2EX - 技术
V2EX - 技术
Cloudbric
Cloudbric
cs.CV updates on arXiv.org
cs.CV updates on arXiv.org
宝玉的分享
宝玉的分享
Know Your Adversary
Know Your Adversary
爱范儿
爱范儿
OSCHINA 社区最新新闻
OSCHINA 社区最新新闻
cs.CL updates on arXiv.org
cs.CL updates on arXiv.org
S
Schneier on Security
博客园 - 【当耐特】
G
Google Developers Blog
S
Security @ Cisco Blogs
N
Netflix TechBlog - Medium
T
Tenable Blog
C
Check Point Blog
The Cloudflare Blog
J
Java Code Geeks
The Register - Security
The Register - Security
Google Online Security Blog
Google Online Security Blog
Security Latest
Security Latest
T
Tor Project blog
T
The Blog of Author Tim Ferriss
S
Security Affairs
S
Securelist
P
Privacy & Cybersecurity Law Blog
Security Archives - TechRepublic
Security Archives - TechRepublic
P
Privacy International News Feed
博客园 - 三生石上(FineUI控件)
D
DataBreaches.Net
N
News and Events Feed by Topic
Hacker News - Newest:
Hacker News - Newest: "LLM"
让小产品的独立变现更简单 - ezindie.com
让小产品的独立变现更简单 - ezindie.com
A
About on SuperTechFans
G
GRAHAM CLULEY
Jina AI
Jina AI
Spread Privacy
Spread Privacy

CSS Wizardry

Front-End’s Missing Metric: The TBT Window Meet Your Users Where They Are with Obs.js Better Browser Caching with No-Vary-Search font-family Doesn’t Fall Back the Way You Think What Is CSS Containment and How Can I Use It? Obs.js: Context-Aware Web Performance for Everyone Low- and Mid-Tier Mobile for the Real World (2025) The Fastest Site in the Tour de France Making Sense of the Performance Extensibility API Why Do We Have a Cache-Control Request Header? HTML Is Not a Programming Language… Build for the Web, Build on the Web, Build with the Web Licensing Code on CSS Wizardry A Layered Approach to Speculation Rules Designing (and Evolving) a New Web Performance Score Core Web Vitals Colours The Ultimate Contract Templates for Tech Consultants: Protect Your Business and Get Paid Optimising for High Latency Environments Cache Grab: How Much Are You Leaving on the Table? blocking=render: Why would you do that?! Correctly Configure (Pre) Connections The Three Cs: 🤝 Concatenate, 🗜️ Compress, 🗳️ Cache What Is the Maximum max-age? How to Clear Cache and Cookies on a Customer’s Device The Ultimate Low-Quality Image Placeholder Technique Core Web Vitals for Search Engine Optimisation: What Do We Need to Know? The HTTP/1-liness of HTTP/2 In Defence of DOM­Content­Loaded Site-Speed Topography Remapped Why Not document.write()? Speeding Up Async Snippets Critical CSS? Not So Fast! Measure What You Impact, Not What You Influence Optimising Largest Contentful Paint Measuring Web Performance in Mobile Safari Site-Speed Topography Speed Up Google Fonts Real-World Effectiveness of Brotli Performance Budgets, Pragmatically Lazy Pre-Browsing with Prefetch Making Cloud.typography Fast(er) Time to First Byte: What It Is and How to Improve It Self-Host Your Static Assets Tips for Technical Interviews Cache-Control for Civilians Bandwidth or Latency: When to Optimise for Which ITCSS × Skillshare What If? CSS and Network Performance The Three Types of Performance Testing Getting to Know a Legacy Codebase Image Inconsistencies: How and When Browsers Download Images Identifying, Auditing, and Discussing Third Parties My Digital Music Setup Measuring the Hard-to-Measure Finding Dead CSS The Fallacies of Distributed Computing (Applied to Front-End Performance) Ten Years Old Relative Requirements Airplanes and Ashtrays Performance and Resilience: Stress-Testing Third Parties Refactoring Tunnels Little Things I Like to Do with Git Writing Tidy Code Configuring Git and Vim Base64 Encoding & Performance, Part 2: Gathering Data Base64 Encoding & Performance, Part 1: What’s Up with Base64? Code Smells in CSS Revisited Typography for Developers Moving CSS Wizardry onto HTTPS and HTTP/2 Ack for CSS Developers A New Year, a New Focus Preparing Vim for Apple’s Touch Bar Choosing the Correct Average CSS Shorthand Syntax Considered an Anti-Pattern CSS Wizardry Newsletter Nesting Your BEM? Improving Perceived Performance with Multiple Background Images Continue Normalising Your CSS Pure CSS Content Filter Pragmatic, Practical, and Progressive Theming with Custom Properties Refactoring CSS: The Three I’s Speaker’s Checklist: Before and After Your Talk Improving Your CSS with Parker The Importance of !important: Forcing Immutability in CSS Mixins Better for Performance Managing Typography on Large Apps White October Events Workshop Partnership BEMIT: Taking the BEM Naming Convention a Step Further Travelling Like You Want to, When You Have To Contextual Styling: UI Components, Nesting, and Implementation Detail Subtleties with Self-Chained Classes Cyclomatic Complexity: Logic in CSS Immutable CSS Can CSS Be Too Modular? More Transparent UI Code with Namespaces When to use @extend; when to use a mixin The Specificity Graph CSS Wizardry Ltd.: Year 1 in review CSS Guidelines 2.0.0
When All You Can Do Is All or Nothing, Do Nothing
Harry Roberts · 2026-03-30 · via CSS Wizardry

Written by on CSS Wizardry.

Table of Contents

Independent writing is brought to you via my wonderful Supporters.

  1. Tools and Context
  2. Dumb Design Systems
  3. fetchpriority=high
  4. The Browser Default Is Not Failure
  5. Missed Opportunities Are Safer Than Bad Optimisations
  6. Use Hints Where You Have Certainty
  7. Do Nothing, Deliberately

I’ve been working a lot over the last few years on the idea of web performance for design systems. While a lot of my clients want me to start at the end and work back (we have a slow site, how can we make it faster?), particularly ambitious clients ask how can we bake web performance in from the start? This post comes from a specific bit of advice I gave a client recently.

Their design system sits on top of a highly permissive CMS. Editors have a lot of freedom—which is great—but it means the system often does not know, or cannot tell, if a component will render above or below the fold, on or off screen, or whether it will appear once or many times on the page.

This makes things like loading=lazy and fetchpriority=high awkward: if an image might be an LCP candidate, then loading=lazy is bad news; if several images might be LCP candidates, then fetchpriority=high on all of them is bad news, too—when everything is high priority, nothing is.

And so my take is this: when all you can do is all or nothing, do nothing.

Tools and Context

loading=lazy only helps if you apply it to things the user does not yet need, but apply it to something needed immediately and you may have made the page worse.

Similarly, fetchpriority=high only helps if you use it to identify one likely winner among a field of contenders: apply it to all contenders and you have not clarified anything, you’ve just added noise.

These are not magic make it faster attributes, they are hints, and hints are only useful when they are specific and contextual.

Dumb Design Systems

A design system (or any system, really) should never try to know more than it really does. Imagine a reusable card component:

<article class=c-card>
  <img src=/img/promo.jpg
       alt="Promotional image"
       width=640
       height=360
       loading=lazy>

  <h2>Spring Collection</h2>
  <p>Discover the latest arrivals.</p>
</article>

If this component always lived in a product grid halfway down the page, sure, lazy-load it. But if CMS users can also use it:

  • as a hero/LCP candidate;
  • as the first component below the masthead;
  • in a two-up where one card is above the fold and the other beneath;
  • or in a genuinely off-screen position;

…then the design system doesn’t have the right to guess.

In that world, this change is safer:

<article class=c-card>
  <img src=/img/promo.jpg
       alt="Promotional image"
       width=640
       height=360
-      loading=lazy>
+>

  <h2>Spring Collection</h2>
  <p>Discover the latest arrivals.</p>
</article>

In other words, I would recommend you leave the browser to handle it.

That might mean you load a handful of below-the-fold images a little earlier than ideal, and that’s fine. I would certainly rather this be the baseline than potentially inadvertently lazily loading content that doesn’t need it.

As a brief but important side note: loading=lazy does not necessarily mean below the fold.

There are plenty of perfectly reasonable above-the-fold use cases for loading=lazy:

  • the second image onward in a carousel;
  • thumbnail images in a larger image gallery;
  • assets hidden in a hamburger or flyout menu;
  • imagery that is present in the DOM but not meaningfully useful until some JS has initialised the relevant UI.

Those are all cases where an image may be in or near the initial viewport but still not needed yet.

That is the distinction I care about: not strictly below the fold, but not immediately necessary.

fetchpriority=high

The same thinking carries through to fetchpriority. Consider a larger media component:

<img src=/img/campaign.jpg
     alt="Campaign image"
     width=1200
     height=675
     fetchpriority=high>

If you know this is the LCP candidate, then that is a sensible hint! But if the CMS allows three of these near the top of the page, then you end up with:

<img src=/img/hero-1.jpg fetchpriority=high alt="" width=1200 height=675>
<img src=/img/hero-2.jpg fetchpriority=high alt="" width=1200 height=675>
<img src=/img/hero-3.jpg fetchpriority=high alt="" width=1200 height=675>

At that point, you are no longer really prioritising anything. The browser is already trying to work out which requests matter most. If your design system or CMS cannot confidently identify one winner, it shouldn’t flood the network claiming that several things are equally urgent. When everything is high priority, nothing is.

The Browser Default Is Not Failure

Doing nothing here is not negligent, but normal. We didn’t even have these primitives a few years ago. Omitting them is not some devolution; it is just falling back to the norm. The browser discovers images, requests them, and prioritises them as best it can. In ambiguous systems, that is often the most honest and least harmful baseline. Put another way…

Given three options, and the first is taken away from you, would you rather:

  1. do the right thing,
  2. do the wrong thing, or
  3. do nothing?

I think we’d all opt for the latter. Doing nothing is better than doing the wrong thing. This leads me nicely on to…

Missed Opportunities Are Safer Than Bad Optimisations

If I fail to lazy-load an image that turns out not to be needed immediately, I have left a little performance gain on the table, but if I lazy-load an LCP candidate, I have actively made the page worse. Without lazy loading, the worst case scenario is that the browser puts the request(s) out to the network a little eagerly, but it will fall back to other heuristics to prioritise from there.

Likewise, if I omit fetchpriority=high from a hero image, perhaps the browser takes a fraction longer to realise its importance, but if I add fetchpriority=high to every possible hero, I have turned a useful hint into noise. Without fetchpriority=high, the worst case scenario is that the browser puts the request(s) out to the network a little slowly, but it will fall back to other heuristics to prioritise from there.

Both scenarios have great safety nets.

Use Hints Where You Have Certainty

Naturally, this is not an argument against either hint. If your design system really does know that:

  • article-body images after paragraph three are below the fold;
  • the homepage hero is always first, or;
  • carousel slides after the first are off-screen;

…then use them! If you have enough context to be precise, be precise. But if you do not, don’t risk it.

Do Nothing, Deliberately

Sometimes, at design system level, the least clever option is the safest. If all you can do is lazy-load everything or lazy-load nothing, choose nothing; if all you can do is mark several possible winners as high priority, choose none.

And I don’t mean forever, I mean until your system has the knowledge to do more. If or when you can communicate more to the front end, err on the side of caution and do nothing at all.

When all you can do is all or nothing, do nothing.