ProblemYou want to use shorthand properties in style sheets. SolutionBegin with a properly marked up section. <h3>Shorthand Property</h3> <p>Combine properties with shorthand and save time, typing, and a few bytes. Your style sheets will also be easier to read.</p> Then use just one instance of font property instead of three: font-style, font-size, and font-family: h3 { font: italic 18pt verdana, arial, sans-serif; } p { border: 2pt solid black; } DiscussionSeveral CSS properties can be tossed in favor of shorthand properties. The border property is a shorthand property, which combines three properties into one. The border property can cover the values from the following properties:
The font property is a shorthand property, which combines three properties into one. The font property can cover the values from the following properties:
Enter the values just as you would with any other property except for font-family and font-size/line height. With font-family, enter the fonts in the order you wish for them to have priority and use a comma between each. If you use both font-size and line height, then separate their values with a forward slash: h3 { font: italic 18pt/20pt verdana, arial, sans-serif } For a rundown on the shorthand properties available to web developers, see Table 1-4.
See AlsoThe CSS 2.1 specification for border shorthand properties at http://www.w3.org/TR/CSS21/box.html#border-shorthand-properties and font shorthand properties at http://www.w3.org/TR/CSS21/about.html#shorthand; and see Appendix B for a full listing of CSS properties. |