CSS Property Order

I think it would be convenient to write CSS rule properties always in that order. Is there any agreement on this order?

I noticed that it Firebugdisplays CSS properties in alphabetical order. What for? Does HTTP keep the original order of CSS rules?

+4
source share
1 answer

Negative It’s good practice to save as properties together, but there is no longer an “order of operations”, for example, for selectors.

However, the last rule of the type WILL will be adopted from the previous one.

Example:

background-color: #000;
background: #FFF url(image.jpg) 0 0 no-repeat;

Color (if the image does not load) will now be whitebecause it came last.

Example # 2:

border: none;
border-right: 1px solid #000;

, , 1px solid #000, .

: - .

body * {
    margin: 0;
}
...further down
#main {
    margin-top: 2em;
}

#main margin, . , , #main body *, . , .

+5

All Articles