What are the best practices for writing maintainable CSS?

后端 未结 9 1932
礼貌的吻别
礼貌的吻别 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:13

    For me it's good to alphabetize properties of element. It is simple, visible and good for programmer's eye :)

    e.g.

    #my-id 
    {
       color: #fff;
       float: left;
       font-weight:
       height: 200px;
       margin: 0;
       padding: 0;
       width: 150px;
    }
    

    Before production it's recommended to use some of the css compressors to provide gains in performance.

提交回复
热议问题