HTML and CSS Reference
In-Depth Information
With multi-line CSS, you have a much neater comment structure:
Ordering CSS Properties
Likewise, the order in which people write their CSS properties is very
Many people opt for alphabetized CSS, but this is counter-intuitive. I
commented briefly on the subject on GitHub; my reasoning is that ordering
something by a meaningless metric makes no sense; the initial letter of a
declaration has no bearing on the declaration itself. Ordering CSS
alphabetically makes as much sense as ordering CDs by how bright their
covers are.
A more sensible approach is to order by type and relevance. That is, group
your color declarations together, your box-model declarations together, your
font declarations together and so on. Moreover, order each grouping
according to its relevance to the selector. If you are styling an h1 , then put
font-related declarations first, followed by the others. For example:
#header {
/* Box model */
width: 100%;
padding: 20px 0;
/* Color */
color: #fff;
background: #333;
Search WWH ::

Custom Search