4 ms·
> Take time to describe components, how they work, their limitations, and the way they are constructed. Don't leave others in the team guessing as to the purpos
by crazygringo 14y ago
> Take time to describe components, how they work, their limitations, and the way they are constructed. Don't leave others in the team guessing as to the purpose of uncommon or non-obvious code.
One rule I really try to enforce: for any CSS declaration with a non-obvious reason ("position: relative", "z-index: 9999", "zoom: 1", "!important", "display: block" together with "float: left", etc.), it MUST have a comment explaining why.
Which absolutely-positioned child led to this "position: relative"? What is this z-index trying to move this object above/below?
Some people say well-written computer code doesn't need commenting. But with CSS this is NEVER the case.