Building a fast, accessible website

By Kallistesoft · · 3 min read

A fast, accessible website comes mostly from good early choices. After ten years of shipping sites and apps, this one included (plain static HTML), I keep seeing the same mistakes: too much JavaScript, oversized images, weak contrast, keyboards forgotten.

Good thresholds for Core Web Vitals: LCP 2.5 seconds, INP 200 milliseconds, CLS 0.1LCP≤ 2.5 sINP≤ 200 msCLS≤ 0.1
"Good" thresholds for the Core Web Vitals: loading, responsiveness and visual stability.

Static HTML or a framework?

For a marketing site or a blog, static HTML is hard to beat: the browser gets a finished page instead of waiting for a script to build it. Our site is deployed by GitHub Actions to ordinary hosting with almost nothing to maintain. A framework earns its place when interface state gets complex (dashboards, dynamic forms). Even then, generate content ahead of time and keep JavaScript for the interactive parts. The classic trap is picking a framework out of habit for a ten-page site, then spending hours fixing a performance score that plain HTML would have given you for free.

Core Web Vitals

Google publishes "good" thresholds for three metrics (web.dev):

MetricMeasuresThresholdMain lever
LCPRender time of the largest element2.5 sServe the hero image early, small CSS
INPResponsiveness to interactions200 msLess JavaScript, fewer third-party widgets
CLSLayout shifts0.1Declared image sizes, reserved space

For LCP, never put loading="lazy" on the hero image. For CLS, always declare dimensions:

<img src="/img/workspace-800.webp" width="800" height="450"
     alt="Desk with two monitors">
Target loading order: HTML, CSS, hero image, deferred JavaScriptHTMLfinished pageCSSsmallLCP imagehigh priorityJSdeferred
Target loading order: content first, JavaScript last.

Images, fonts and caching

Cache-Control: public, max-age=31536000, immutable   # versioned files
Cache-Control: no-cache                              # HTML pages

Accessibility basics

Use semantic HTML: header, nav, main, a single h1, headings in order, <button> for buttons and <a href> for links. A <div onclick> is neither focusable nor announced by screen readers. Declare lang and label every field.

WCAG asks for at least 4.5:1 contrast on normal text (criterion 1.4.3). Light grey on white is the usual offender; recheck both themes if you offer dark mode. Alt text describes the image's purpose in one sentence; a decorative image gets alt="". For keyboards, never remove the focus outline without replacing it:

:focus-visible { outline: 3px solid #2f6bff; outline-offset: 2px; }

How to test

Checklist

Conclusion

Performance and accessibility come from the same habits: less code, correct HTML, reasonable images. Run the checklist on your most visited page, measure, then repeat.

Sources

Related reading