40

Is it OK to implement Modernizr with Twitter Bootstrap?

I'm currently using Bootstrap with Google's html5shiv and I wanted to know if I can use Modernizr instead or is it overkill just to get HTML5 elements activated for older IE browsers?

Thanks in advance

James Allardice
  • 164,175
  • 21
  • 332
  • 312
Wasabi Developer
  • 3,523
  • 6
  • 36
  • 60
  • 3
    If you decide to implement CSP at some point you should be aware that, while Bootstrap works fine with it, [Modenizr fails](http://stackoverflow.com/questions/26532234/modernizr-causes-content-security-policy-csp-violation-errors). This means that your XSS protection options will be limited if you choose to use it. – Keith Feb 12 '15 at 11:13
  • @Keith thanks for the info and link. Really helpful! – Wasabi Developer Jun 09 '15 at 05:57

1 Answers1

63

Modernizr is a test suite that adds feature detection via classes applied to the body tag. It includes HTML5Shi(v|m) to add older browser compatibility. You don't need Modernizr just to style new tags in older browsers.

That said, it is OK to include Modernizr with Twitter Bootstrap. You can even get an auto-generated H5BP template with Bootstrap and Modernizr included at Initializr.

gsamaras
  • 71,951
  • 46
  • 188
  • 305
Evan Davis
  • 35,493
  • 6
  • 50
  • 57