← Back to HTML
18

Web Performance from HTML: Core Web Vitals in Practice

Improve LCP, CLS and interaction quality from the markup itself with smarter loading and layout decisions.

📘 Theory

A quick map of the metrics you can influence in HTML

Think in terms of causes and effects, not isolated tricks.

1

LCP

Prioritize the main resource with `preload` or `fetchpriority`.

2

CLS

Set `width` and `height` to avoid layout jumps.

3

INP

Reduce early blocking work with deferred scripts and calmer startup.

Prioritizing critical resources

Not everything deserves the same urgency.

Browsers need clues to decide what should download first. If the first screen depends on a large hero image or a specific font, tell the browser clearly.

Do not overuse `preload`. It should be reserved for assets that truly matter to the initial render.

  • Keep the main stylesheet in the head.
  • Give the hero image `fetchpriority="high"` when it is your LCP candidate.
  • Lazy-load secondary images that do not matter above the fold.

Visual stability: avoid layout shifts

Users hate clicking targets that move at the last moment.

1

Many layout shifts come from images without dimensions, embeds injected late or dynamic blocks with no reserved space.

2

The fix is often simple: define dimensions and stable containers from the HTML before the browser paints the page.

🧪 Learn by doing

Example Guided example: an optimized hero image Combine image priority, dimensions and a sensible loading strategy.

🏁 Challenges

Challenge Challenge: remove layout shifts Add the minimum attributes needed to stabilize an image.

🧰 Resources

What is this?

I'm Cristian Eslava and I sometimes build websites so both you and I can learn and experiment. culTest

I made this in February 2026 to make learning easier for my students. The idea is to learn web development by practicing and to keep expanding the project with new topics, tests and challenges.

It draws inspiration from MDN, W3Schools, CodePen, Manz and many other web development references. I wanted to combine useful theory, runnable examples, challenges and the testing system I had already built for culTest. culTest

If you liked it, if you didn't, or if you want to get in touch, write to me at cristianeslava@gmail.com