Modernizr How to do border-radius

孤街浪徒 提交于 2019-12-06 05:37:38

问题


Could you please make me little bit clear about Modernizr.

If I use a feature (say, border-radius) and I run it using an older browser. Will the modernizer automatically add css to the page OR should I write code to render the control to view like having borders. If the second case is true, then WHY should I use Modernizr?


回答1:


Modernizr gives you mostly ways to test for HTML5 support, and then load in shims for what you're missing so that you can code to one, modern standard. It doesn't update the browser's native behaviors. So for CSS, while it detects whether or not your browser supports border radius, it doesn't figure out a way to emulate that support.

It would however allow you to decide to load in something to support them like css3 pie.




回答2:


Modernizr lets you detect if a particular feature (say border-radius) is supported in the browser. If it is not supported, you can use Modernizr.load() to load a polyfill that mimics the functionality on that browser. This allows the modern browsers to use their built-in features (which will be faster) and lets you load the polyfill only on the browsers that need it.

More info on Modernizr.load : http://www.modernizr.com/docs/#load

Useful list of polyfills : https://github.com/Modernizr/Modernizr/wiki/HTML5-Cross-browser-Polyfills



来源:https://stackoverflow.com/questions/8089984/modernizr-how-to-do-border-radius

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!