Html 可以使用 Twitter Bootstrap 实现 Modernizr 吗?

声明:本页面是StackOverFlow热门问题的中英对照翻译,遵循CC BY-SA 4.0协议,如果您需要使用它,必须同样遵循CC BY-SA许可,注明原文地址和作者信息,同时你必须将它归于原作者(不是我):StackOverFlow 原文地址: http://stackoverflow.com/questions/11209478/
Warning: these are provided under cc-by-sa 4.0 license. You are free to use/share it, But you must attribute it to the original authors (not me): StackOverFlow

提示:将鼠标放在中文语句上可以显示对应的英文。显示中英文
时间:2020-08-29 01:17:13  来源:igfitidea点击:

Is okay to implement Modernizr with Twitter Bootstrap?

htmltwitter-bootstrapmodernizrhtml5shiv

提问by Wasabi Developer

Is it OK to implement Modernizr with Twitter Bootstrap?

可以使用 Twitter Bootstrap 实现 Modernizr 吗?

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?

我目前正在将 Bootstrap 与 Google 的 html5shiv 一起使用,我想知道我是否可以使用 Modernizr 或者只是为旧版 IE 浏览器激活 HTML5 元素是否太过分了?

Thanks in advance

提前致谢

回答by Mathletics

Modernizr is a test suite that adds feature detectionvia 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.

Modernizr 是一个测试套件,它通过应用于 body 标签的类来添加特征检测。它包括 HTML5Shi(v|m) 以添加旧浏览器兼容性。您不需要 Modernizr 只是为了在旧浏览器中设置新标签的样式。

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.

也就是说,在 Twitter Bootstrap 中包含 Modernizr 是可以的。您甚至可以使用Initializr 中包含的 Bootstrap 和 Modernizr 获取自动生成的 H5BP 模板。