What is the purpose of the HTML “no-js” class?

Q I notice that in a lot of template engines, in the HTML5 Boilerplate, in various frameworks and in plain php sites there is the no-js class added onto the <HTML> tag.Why is this done? Is there some sort of default browser behavior that reacts to this class? Why include it always? Does that not render the class itself obsolete, if there is no no-“no-js” case and html can be addressed directly?

<html lang="en-US" class="no-js no-svg">
A When Modernizr runs, it removes the “no-js” class and replaces it with “js”. This is a way to apply different CSS rules depending on whether or not Javascript support is enabled.

What is the purpose of the HTML “no-js” class?

引用:Stack Overflow

Leave a Reply

Your email address will not be published. Required fields are marked *