HTML and CSS Reference
In-Depth Information
Shorthand Notation for Font Properties
Font properties can be written either in the full form shown in Listing 5-36 or with the shorthand notation
of Listing 5-37.
Listing 5-36. If Several Font Properties Should Be Set for the Same Element, the Ruleset Becomes Too Long
p {
font-weight: bold;
font-size: 1em;
line-height: 1.2em;
font-family: Garamond;
font-style: normal;
}
Listing 5-37. Shorthand Notation for Font Properties
p { font: bold 1em/1.2em Garamond }
In the second case, the font-style property is not set and thus takes the value defined as the default value
for that property in the CSS specification, which is normal .
Note
Shorthand Notation for Background Properties
Separate background properties (Listing 5-38) have the shorthand property background (Listing 5-39).
Listing 5-38. Separate Background Properties That Can Be Shortened
body {
background-color: #232323;
background-image: url('images/bg.jpg');
background-repeat: no-repeat;
background-position: 100% 0%;
background-attachment: fixed;
}
Listing 5-39. Background Properties Combined into a Single Background Property
body {
background: #232323 url('images/bg.jpg') no-repeat 100% 0% fixed;
}
Shorthand Notation for List Properties
List styles, such as the ones in Listing 5-40, can also be shortened by the enumeration of the individual property
values for the list-style shorthand property (Listing 5-41).
 
 
Search WWH ::




Custom Search