css-remunit.js 499 B

12345678910111213141516171819
  1. // test by github.com/nsfmc
  2. // "The 'rem' unit ('root em') is relative to the computed
  3. // value of the 'font-size' value of the root element."
  4. // http://www.w3.org/TR/css3-values/#relative0
  5. // you can test by checking if the prop was ditched
  6. // http://snook.ca/archives/html_and_css/font-size-with-rem
  7. Modernizr.addTest('cssremunit', function(){
  8. var div = document.createElement('div');
  9. try {
  10. div.style.fontSize = '3rem';
  11. } catch(er){}
  12. return (/rem/).test(div.style.fontSize);
  13. });