Assigning classes to elements through CSS

后端 未结 3 589
我在风中等你
我在风中等你 2020-12-09 01:32

I\'d like to tell the browser to assign certain CSS classes to elements matching a particular selector. Can I do it with pure CSS and if yes, how?

Example: I want al

3条回答
  •  伪装坚强ぢ
    2020-12-09 02:12

    No, that isn't possible with pure CSS.

    Only with JavaScript:

    // jQuery
    $("h5").addClass("ui-corners-all");
    
    // Pure JavaScript
    var elements = document.getElementsByTagName("h5");
    for (var i=0; i

提交回复
热议问题