Modernizr is a JavaScript library that detects which CSS and HTML5 features are supported by the user's browser. It allows for progressive enhancement by applying features when supported and providing alternatives when not. This helps websites work on a wide range of browsers while still taking advantage of newer features for supported browsers.