Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Modernizr How to do border-radius

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?

like image 418
Rauf Avatar asked Dec 06 '22 18:12

Rauf


2 Answers

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.

like image 55
dlamblin Avatar answered Dec 27 '22 18:12

dlamblin


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

like image 20
pradeek Avatar answered Dec 27 '22 19:12

pradeek