How to apply two CSS classes to a single element

前端 未结 7 820
Happy的楠姐
Happy的楠姐 2020-11-27 13:52

Can i apply 2 classes to a single div or span or any html element? For example:

aa

I tried and

7条回答
  •  谎友^
    谎友^ (楼主)
    2020-11-27 14:44

    1) Use multiple classes inside the class attribute, separated by whitespace (ref):

    aa
    

    2) To target elements that contain all of the specified classes, use this CSS selector (no space) (ref):

    .c1.c2 {
    }
    

提交回复
热议问题