What are the best practices for writing maintainable CSS?

后端 未结 9 1933
礼貌的吻别
礼貌的吻别 2021-02-06 04:25

I am just starting to explore this area and wonder what are the best practices when it comes to production of clean, well-structured and maintainable CSSes.

There seems

9条回答
  •  予麋鹿
    予麋鹿 (楼主)
    2021-02-06 05:08

    Personally, I use the first method, but I also indent child selectors. For example:

    .my-class {
        /* stuff here */
    }
    
        .my-class tr {
            /* stuff here */
        }
    
            .my-class tr a {
                /* stuff here */
            }
    

    Dunno about best practices though, aside from putting the opening brace on the same line as the closing one, and ending each property with a semi-colon, even if it's the last one.

提交回复
热议问题