Re: [WSG] opinions on use of css shorthand properties
A good point! By set these values previously, Mark means set these values further up the document tree. For example, if you set font-weight: bold on a container (like a div element), this will be inherited by elements within that container (like content within a p element). In these particular circumstances you would set font-weight: normal on the p element to turn the bold off. However, as Mark says, in most circumstances you would not need to specify font-weight: normal on each element. More on the document tree (critical in coming to terms with CSS) here: http://css.maxdesign.com.au/selectutorial/document_tree.htm Russ One more thing: font-variant: normal; font-style: normal; font-stretch: normal; font-size-adjust: none These are all completely redundant because they are the default values. Unless you have reset these values previously, you don't need to set them to their default values. * The discussion list for http://webstandardsgroup.org/ *
Re: [WSG] opinions on use of css shorthand properties
The first question you need to asks is what browsers you intend to support. That will dictate many things, including the amount of shorthand css you use. For example, if you are including NN4 as one of your target browsers, this will limit the amount of shorthand CSS you can use. Once you have made your browser support decision, check out one of the many shorthand css support charts to determine which shorthand rules you can then use. Generally speaking, shorthand rules are great for file size as well as development and maintenance - easier to write and maintain. Russ I have noticed an increasing number of sites using shorthand properties for css eg: h1 { font: bold 12pt/14pt Helvetica } however I know that just like actual css implementation, different browsers support some/all/none of the shorthand properties so is it worth using shorthand to create a smaller css file or as im doing at the moment is being explicit with every property the safest way to go eg: h1 { font-weight: bold; font-size: 12pt; line-height: 14pt; font-family: Helvetica; font-variant: normal; font-style: normal; font-stretch: normal; font-size-adjust: none } * The discussion list for http://webstandardsgroup.org/ *
RE: [WSG] opinions on use of css shorthand properties
I agree with Russ - it's a mostly a matter of personal preference. Initially shorthand can be confusing but with time it becomes the easier option. One more thing: font-variant: normal; font-style: normal; font-stretch: normal; font-size-adjust: none These are all completely redundant because they are the default values. Unless you have reset these values previously, you don't need to set them to their default values. Cheers Mark -- Mark Stanton Technical Director Gruden Pty Ltd Tel: 9956 6388 Mob: 0410 458 201 Fax: 9956 8433 http://www.gruden.com * The discussion list for http://webstandardsgroup.org/ *