Home

Modernizr

Modernizr is a JavaScript library that detects support for HTML5 and CSS3 features in a user’s browser. Rather than relying on browser detection, Modernizr runs a series of feature tests and exposes the results as boolean properties on a global Modernizr object and as CSS classes on the document’s root element. For example, if the browser supports flexbox, Modernizr.flexbox will be true and the html element will receive a "flexbox" class; if not, a "no-flexbox" class is added. This allows developers to apply progressive enhancement through CSS selectors like .flexbox and .no-flexbox or to conditionally execute JavaScript and load polyfills when a feature is missing.

Modernizr is typically loaded at the start of a page. A developer can either include the full

The project was created by Faruk Ateş and released in the early 2010s as an open-source tool

Criticism and considerations: feature detection can be imperfect for some APIs, and including a large default

library
or
generate
a
custom
build
containing
only
the
tests
they
need
via
Modernizr’s
download
builder.
It
does
not
polyfill
features
itself,
but
it
enables
the
use
of
polyfills
or
alternative
code
paths
when
a
given
feature
is
unavailable.
under
a
permissive
license.
Over
time,
Modernizr
has
evolved
with
new
tests
for
CSS
and
HTML
features
and
provides
an
extensible
API
for
adding
custom
tests.
build
can
impact
page
load
time.
For
many
modern
development
workflows,
a
minimal,
custom
Modernizr
build
or
alternative
feature-detection
strategies
may
be
preferred.