As HTML5 and CSS3 started appearing more often in real projects, browser support became harder to talk about in simple terms. It was no longer enough to say that one browser supported modern features and another did not. Support was uneven, partial and sometimes surprising.
That was why Modernizr felt useful. Instead of guessing what a browser could do based on its name or version, it encouraged a more practical question: does this browser support the feature I want to use? That way of thinking was much closer to how a website actually behaves.
The appeal was not that Modernizr made every compatibility problem disappear. It gave the code a more honest route through those problems. The page could test for support, then decide whether to use the enhanced behaviour or fall back to something simpler.
Why Browser Detection Felt Fragile
Browser detection had always felt slightly uncomfortable because it made assumptions. A browser name or user agent string might suggest one thing, but the actual feature support could be different. Users could also be on unusual builds, embedded browsers or environments that did not match the neat categories developers wanted.
Feature detection avoided some of that fragility. If the site needed CSS gradients, geolocation, local storage or another newer feature, it could test for that capability directly. The decision became based on behaviour rather than identity.
Using It To Keep CSS Manageable
One useful part of Modernizr was the way it added classes to the html element. That meant CSS could respond to supported or unsupported features without becoming a collection of browser-specific hacks.
.cssgradients .button {
background: linear-gradient(#ffffff, #eeeeee);
}
.no-cssgradients .button {
background: #eeeeee;
}
That kind of structure made fallbacks easier to read. Instead of hiding the compatibility logic in comments and workarounds, the CSS made the decision visible.
The Risk Of Testing Too Much
I still think there is a risk in adding tests for everything. A website can become complicated if every feature has several branches of behaviour. The better approach is to test for the capabilities that genuinely affect the experience, not every modern feature being used for decoration.
Modernizr made me think more carefully about capability. It encouraged a cleaner conversation than asking which browser someone was using. The more useful question was what the browser could actually do.