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

后端 未结 7 1188
误落风尘
误落风尘 2020-11-27 08:59

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

7条回答
  •  栀梦
    栀梦 (楼主)
    2020-11-27 09:22

    This is not only applicable in Modernizer. I see some site implement like below to check whether it has javascript support or not.

    
        
        ...
    
    

    If javascript support is there, then it will remove no-js class. Otherwise no-js will remain in the body tag. Then they control the styles in the css when no javascript support.

    .no-js .some-class-name {
    
    }
    

提交回复
热议问题