Answer the question
In order to leave comments, you need to log in
How to write CSS code in a good style?
Hello!
I want to write CSS code in a single style on projects (property order, indents, class names or identifiers, etc.). If there are any standards - throw off, please, a link to the information.
It is desirable that the information about the rules for writing code be complete.
PHP example: PSR standards
Answer the question
In order to leave comments, you need to log in
As such, there are no standards. As a rule, in each organization in which you will work, there is a style guide for all known technologies. If you're working solo, then try one of the class naming patterns. For example, google OOCSS , MCSS or BEM .
Sticking to a certain property order when writing CSS is tricky. Here it is much easier to use the post-processing of the CSS file. For example, the @MonkAlbino user mentioned here, CSScomb , or another more advanced solution.
You can also use other people's style guides if they are freely available. For example, Google HTML/CSS Style Guide .
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question