What are the best practices for writing maintainable CSS?

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

    I'll usually group all properties that apply to the same element together -- it makes it slightly less annoying trying to find everything that applies, and makes it a little easier to keep from duplicating properties. If i have three different .my-class rules, i won't be surprised in the not-so-distant future to find them all setting some property two or three times because someone was rushed and just looked for the nearest selector that looked right.

提交回复
热议问题