How can I apply styles to multiple classes at once?

前端 未结 5 1250
刺人心
刺人心 2020-11-29 21:10

I want two classes with different names to have the same property in CSS. I don\'t want to repeat the code.

5条回答
  •  孤街浪徒
    2020-11-29 22:04

    If you use as following, your code can be more effective than you wrote. You should add another feature.

    .abc, .xyz {
    margin-left:20px;
    width: 100px;
    height: 100px;
    } 
    

    OR

    a.abc, a.xyz {
    margin-left:20px;
    width: 100px;
    height: 100px;
    } 
    

    OR

    a {
    margin-left:20px;
    width: 100px;
    height: 100px;
    } 
    

提交回复
热议问题