Modernizr ist ein Javascript, welches die Unterstützung von CSS3 und HTML5 -Funktionen als CSS-Klassen in den <html> Tag der Webseite einfügt. Damit lassen sich dann CSS-basierte Fallbacklösungen leicht einbauen.
Das sieht dann beispielsweise so aus:
<html xmlns="http://www.w3.org/1999/xhtml" xml:lang="de" lang="de" class=" js flexbox canvas canvastext no-webgl no-touch geolocation postmessage websqldatabase no-indexeddb hashchange history draganddrop websockets rgba hsla multiplebgs backgroundsize borderimage borderradius boxshadow textshadow opacity cssanimations csscolumns cssgradients cssreflections csstransforms csstransforms3d csstransitions fontface video audio localstorage sessionstorage webworkers applicationcache svg no-inlinesvg smil svgclippaths">
Eine CSS-Weiche würde dann so aussehen:
/* Wenn @font-face unterstützt wird */
.fontface #header {
font-size: 22px;
font-weight: normal;
}
/* Wenn @font-face nicht unterstützt wird */
.no-fontface #header {
font-size: 18px;
font-weight: bold;
}
Mit Javascript kann man die Unterstützung ebenfalls abfragen:
if(Modernizr.csscolumns) {
alert('Spaltenfluss wird unterstützt');
}
www.modernizr.com