A simple way to check if CSS is supported or disabled is to use jQuery.css() function. For example in my style sheet I can define a div element named #checkCSS with a property of ‘font-size: 50px’. Now in my javascript code, I can use jQuery(‘#checkCSS’).css(‘fontSize’) to retrive the font size of the selected div element. If CSS is enabled, the value return will be ‘50px’ (as specified in the style sheet), however if CSS is not supported or has been disabled, then we will get the value of ‘16px’. This is because the default font-size for most common browsers is 16px. Therefore we can use this simple jQuery function to determine if the browser detects any CSS styles.

Post a Comment

*
*