Improving an existing stylesheet without starting over

By Gyata Tabiri · Revised October 30, 2026

An existing stylesheet can contain a lot of useful work, even when it has become difficult to change. I prefer to understand the dependency behind a rule before deciding whether to keep, replace, or consolidate it.

Establish a baseline

Choose representative pages and important states, then record how they behave. Include navigation, forms, tables, and content with unusually long text. Screenshots help compare appearance; they do not replace interaction checks.

Choose one repeated problem

A cluster of inconsistent colors or duplicate button rules is a manageable starting point. Identify which values serve the same role before extracting a custom property or shared class. Values that happen to match today may need different responsibilities later.

Change and verify in small steps

Apply the new rule to one pattern, check its other uses, and remove the obsolete declaration when the replacement is established. Keeping both indefinitely can hide which rule is doing the work. Avoid unrelated visual changes in the same step.

Leave the reason behind

Document an exception when the context is not obvious from the code. A brief explanation of the dependency is often more useful than a long comment describing the declaration. The goal is a stylesheet the next person can safely change, not simply a shorter file.

That approach is especially useful when a site has to keep operating during an improvement. It gives the team a sequence it can review, rather than a large replacement whose effects are difficult to separate.

Web and UX portfolio · Discuss a role or project