tailieunhanh - Sams Teach Yourself CSS in 24 Hours- P5

Sams Teach Yourself CSS in 24 Hours- P5: Times have changed, thankfully, since those Dark Ages of CSS. All major browsers as well as some minor ones have increased support for Cascading Style Sheets in the latest versions. Web developers are aware of CSS and the vital role they play in designing great Web pages, and presumably you’ve got some idea of how important they are if you’ve bought this book. | 182 Hour 10 Fixed backgrounds are supposed to be placed relative to the page even when set on boxes within the page however Internet Explorer positions them relative to the box of the element being styled. This is most clearly illustrated in Eric Meyer s css edge spiral which was used as an example in Hour 3 Browser Support for CSS. The background Shorthand Property Like the font property background is a shorthand property that allows you to set several properties at once. By using background you can set the background-color the background-image the background-repeat the background-position and the background-attachment. Simply list the values you want in any order as the value for background any values you don t set will be set to their default values. The CSS rules used to create Figure can be rewritten like this body color white background url repeat-x fixed top left gray Summary The background of any element can be set using the background-color and backgroundimage properties. When using backgrounds make sure there is contrast between the colors you re using including image colors and also ensure that you ve set the foreground colors as well. The tiling position and scrolling of the background image can be set using the background-repeat background-position and background-attachment properties. All of the background properties can be set at once using the background shorthand property. Browser Support Report Card CSS Feature Grade Notes background-color A background-image A background-repeat A background-position B Workaround needed for Netscape 4 background-attachment B- Workaround needed for Netscape 4 plus IE quirks background B- Workaround needed for Netscape 4 plus IE quirks Backgrounds and Background Colors 183 Note that because the background shorthand property sets background-position and background-attachment properties it has the same problems as those other properties. Q A Q What if I want a graphic to tile across the page horizontally

TỪ KHÓA LIÊN QUAN