Can a CSS class inherit one or more other classes?

前端 未结 30 3661
挽巷
挽巷 2020-11-22 00:01

I feel dumb for having been a web programmer for so long and not knowing the answer to this question, I actually hope it\'s possible and I just didn\'t know about rather tha

30条回答
  •  萌比男神i
    2020-11-22 00:32

    Keep your common attributes together and assign specific (or override) attributes again.

    /*  ------------------------------------------------------------------------------ */   
    /*  Headings */ 
    /*  ------------------------------------------------------------------------------ */   
    h1, h2, h3, h4
    {
        font-family         : myfind-bold;
        color               : #4C4C4C;
        display:inline-block;
        width:900px;
        text-align:left;
        background-image: linear-gradient(0,   #F4F4F4, #FEFEFE);/* IE6 & IE7 */
    }
    
    h1  
    {
        font-size           : 300%;
        padding             : 45px 40px 45px 0px;
    }
    
    h2
    {
        font-size           : 200%;
        padding             : 30px 25px 30px 0px;
    }
    

提交回复
热议问题