Re: order of properties

On 11 Mar 2003, at 1:40, Sigurd wrote:

> Does the order of the properties in a style declaration matter?
> I know that the order of the style declarations matter. What I'm asking
> is
> .test {left: 20px; right:30px; }
> Does the order of left and right matter?
> If it does I have to rethink my implementation :( :)

The answer is: It can matter.

If the properties have nothing to do with one another, then it doesn't 
matter. however take for example the declaration:

.boldtext {font-weight:bold; font serif}

Since the font property sets the font-weight to normal if it is isn't 
specified, the text in the will in this case be normal and not bold.
Reversing the order to

.boldtext {font:serif; font-weight:bold}

causes the text to be bold. On the other hand,

.bluebox {background-color: blue; background: url(waves.png)}

will have a blue background even if the the waves.png can't be 
displayed, even tho the background property can set the background 
color also, and the default for background-color is transparent.

I'm not certain, but I think that the shortcut properties such as 
background only set properties back to the default values of the 
individual properties when they are not mentioned if and only if the 
individualy property is inheritable. In any case you can check the spec 
for each property individually to make certain..

Received on Monday, 10 March 2003 15:12:46 UTC