Be a clean CSS coder (part one)
We all have struggled with somebody else's CSS code. I am doing now, so I want to share my suggestions, observations.
There are many ways writes to write CSS code. Let me show you how to write it so everyone will instantly read it, with pleasure.
.class {
property: value;
}
Names
Use a name that describes what you are styling. Do not give a name "Snoopie" for a form button. Make it simple, short and above all, descriptive.
Indents
Remember about them. Some people use many values, but two spaces are just perfect.
Space
After you write a property, it is good to leave a space before you write a value. It is much more readable, at least it is what I think.
Consistency
Whatever you do, do it repeatedly. When you define your coding style, be consistent and always use the same style. Always.
Written by Piotr Krzoska
Related protips
4 Responses
Hi. Do you put a ;
after a block? Why?
@fernandoperigolo my mistake, sorry
now it is correct
@krzochalski, ok, no problem. Waiting for the second part. See you.
I am glad that someone read this carefully and gave me feedback about the error. Next part tomorrow