How can I select an element with multiple classes in CSS?

This question already has an answer here:

  • How can I select an element with multiple classes in jQuery? 10 answers
  • Select element based on multiple classes 2 answers

  • No. You should combine individual class names using . :

    .twelve-col.col.main-menu
    

    最有效的选择器将是nav.twelve-col.col.main-menu你也可以使用nav.main-menu ,这是有道理的。


    No. Your selector is trying to find main-menu INSIDE col which is INSIDE twelve-col . But you are looking for element, that has twelve-col col main-menu classes the same time, so use .twelve-col.col.main-menu

    However try BEM methodology, where you use just one class to make all your selectors same specificity (http://getbem.com)

    链接地址: http://www.djcxy.com/p/83092.html

    上一篇: 如何使用jQuery删除两个类名的li和ol

    下一篇: 我如何选择一个CSS中有多个类的元素?