[thelist] CSS - Clarification on Code

Marc Seyon seyon at delime.com
Thu Oct 2 17:00:43 CDT 2003


Hi Brian,

Message from Brian (10/2/2003 04:04 PM)
>What differences, if any, are there in the following examples:
>
>1) list-style: none;
>&
>list-style-type: none;
>EX: http://www.maxdesign.com.au/presentation/listutorial/horizontal02.htm

The 'list-style' property is a shorthand notation for setting the three 
properties 'list-style-type', 'list-style-image', and 'list-style-position' 
at the same place in the style sheet.
http://www.w3.org/TR/CSS2/generate.html#propdef-list-style


>2) margin: 0px;
>&
>margin: 0;

The format of a length value (denoted by <length> in this specification) is 
an optional sign character ('+' or '-', with '+' being the default) 
immediately followed by a <number> (with or without a decimal point) 
immediately followed by a unit identifier (e.g., px, deg, etc.). After the 
'0' length, the unit identifier is optional.
http://www.w3.org/TR/CSS2/syndata.html#length-units

Transliteration: if the value is 0, you can omit the "px" or other measurement.

>3) background: #ccc;
>&
>background-color: #ccc;

The 'background' property is a shorthand property for setting the 
individual background properties (i.e., 'background-color', 
'background-image', 'background-repeat', 'background-attachment' and 
'background-position') at the same place in the style sheet.
http://www.w3.org/TR/CSS2/colors.html#propdef-background

>I am beginning to think these may be personal choice or a shorthand. I 
>have tried all in several situations but have been unable to nail this down.

Warning, using the shorthand to set only one property means that the other 
properties are set to their default state. This could cause issues with 
nesting and inheritance in some cases.

regards.
-marc

--
Carnival 2003 in all its photographic glory. Playyuhself.com
http://www.playyuhself.com/


More information about the thelist mailing list