The Ultimate CSS Reference

Transcription

ALL THE CSS KNOWLEDGE YOU’LL EVER NEED!Authored by two of the world’s most renowned CSS experts, this is a comprehensivereference that you’ll come back to time and time again.ABOUT TOMMY OLSSONR EF E R E N CETo m m y O l s s o n & P a u l O ’ B r i e nTommy has been designing web sites and intranets since writing his firstline of HTML in 1993. Employed as a Technical Webmaster/SoftwareDeveloper at a Swedish public agency, Tommy Olsson is a pragmaticevangelist for web standards and accessibility.CSSThe Ultimate CSS Reference is the definitive resource for mastering CSS. The entirelanguage is clearly and concisely covered, along with browser compatibility details,working examples, and easy-to-read descriptions.THEULTIMATEAlmost every web site created today is built using CSS, which is why a thoroughknowledge of this technology is mandatory for every web designer. There are plentyof good resources to help you learn the basics, but if you’re ready to truly master theintricacies of CSS, this is the book you need.ABOUT PAUL O’BRIENPaul is a freelance web designer specializing in CSS layouts. He enteredthe world of web design back in 1998, and what started as a hobby soonbecame a full-time occupation. You’ll often find Paul giving advice in theSitePoint forums, where he has racked up nearly 20,000 posts — all ofthem CSS-related.Web DesignISBN: 978-0-9802858-5-7USD 44.95REFERENCETo m m y O l s s o n & P a u l O ’ B r i e nCAD 44.950ANTONE #-9 cover-cssref1-final.indd 1CSSTHE ULTIMATE0ANTONE #-9 1/29/2008 5:52:39 PM

The Ultimate CSS Reference (Chapter 8)Thank you for downloading this sample chapter from The Ultimate CSSReference, by Tommy Olsson and Paul O'Brian.This excerpt encapsulates the Summary of Contents, Information about theAuthor and SitePoint, Table of Contents, and Chapter 8: Layout Properties.We hope you find this information useful in evaluating the book.For more information, visit sitepoint.com

Summary of Contents of this Excerpt8. Layout Properties.263Summary of Additional Book Contents1. What is CSS.12. General Syntax and Nomenclature.233. At-rules Reference.474. Selector Reference.595. The Cascade, Specificity, and Inheritance.1176. CSS Layout and Formatting.1397. Box Properties.1879. List Properties.28510. Table Properties.29111. Color and Backgrounds.29912. Typographical Properties.31713. Generated Content.34714. User Interface Properties.35715. Paged Media Properties.36116. Vendor Specific Properties.36717. Workarounds, Filters, and Hacks.39118. Differences Between HTML and XHTML.409Alphabetical Property Index.417

THE ULTIMATECSS REFERENCEBY TOMMY OLSSON& PAUL O’BRIEN

iiThe Ultimate CSS ReferenceThe Ultimate CSS Referenceby Tommy Olsson and Paul O’BrienCopyright 2008 SitePoint Pty LtdManaging Editor: Simon MackieTechnical Director: Kevin YankTechnical Editor: Andrew TetlawEditor: Georgina LaidlawExpert Reviewer: Natalie DowneCover Design: Simon CelenExpert Reviewer: Roger JohanssonInterior Design: Xavier MathieuPrinting History:First Edition: February 2008Notice of RightsAll rights reserved. No part of this book may be reproduced, stored in a retrieval system, or transmittedin any form or by any means, without the prior written permission of the publisher, except in the caseof brief quotations included in critical articles or reviews.Notice of LiabilityThe author and publisher have made every effort to ensure the accuracy of the information herein.However, the information contained in this book is sold without warranty, either express or implied.Neither the authors and SitePoint Pty Ltd, nor its dealers or distributors will be held liable for anydamages to be caused either directly or indirectly by the instructions contained in this book, or by thesoftware or hardware products described herein.Trademark NoticeRather than indicating every occurrence of a trademarked name as such, this book uses the names onlyin an editorial fashion and to the benefit of the trademark owner with no intention of infringement ofthe trademark.Published by SitePoint Pty Ltd48 Cambridge Street CollingwoodVIC Australia 3066Web: www.sitepoint.comEmail: business@sitepoint.comISBN 978–0–9802858–5–7Printed and bound in the United States of America

iiiAbout the AuthorsHailing from Hampshire in the UK, Paul O’Brien is a freelance web designerspecializing in CSS layouts. After selling a successful packaging business back in1998 he was all set for a quiet existence, dabbling with his hobby of web design.However, what started out as a hobby soon became a full-time occupation as thedemand for well-coded CSS layouts started growing. Even when he’s not working,he can be found giving out helpful advice in the SitePoint Forums where he hasracked up nearly 20,000 posts, all of which are CSS-related.Paul’s other passion is karate, which he has studied continuously for 35 years. Hecurrently holds the rank of Third Dan (Sandan) in Shotokan karate, so I wouldn’targue with him if I were you!Tommy Olsson is a pragmatic evangelist for web standards and accessibility, wholives in the outback of central Sweden. Visit his blog athttp://www.autisticcuckoo.net/.About the Expert ReviewersThe always excitable Natalie Downe works for Clearleft, in Brighton, as a client-sideweb developer. An experienced usability consultant and project manager, her firstloves remain front-end development and usability engineering. She enjoys DoingThings Right and occasionally dabbling in the dark art of Python and poking theodd API.Roger Johansson is a web professional with a passion for web standards,accessibility, and usability. He spends his days developing web sites at Swedishweb consultancy NetRelations, and his evenings and weekends writing articles forhis personal sites, http://www.456bereastreet.com/ andhttp://www.kaffesnobben.com/.About the Technical EditorAndrew Tetlaw has been tinkering with web sites as a web developer since 1997and has also worked as a high school English teacher, an English teacher in Japan,a window cleaner, a car washer, a kitchen hand, and a furniture salesman. AtSitePoint he is dedicated to making the world a better place through the technical

ivThe Ultimate CSS Referenceediting of SitePoint books and kits. He is also a busy father of five, enjoys coffee,and often neglects his blog at http://tetlaw.id.au/.About the Technical DirectorAs Technical Director for SitePoint, Kevin Yank oversees all of its technicalpublications—books, articles, newsletters, and blogs. He has written over 50 articlesfor SitePoint, but is best known for his book, Build Your Own Database DrivenWebsite Using PHP & MySQL. Kevin lives in Melbourne, Australia, and enjoysperforming improvised comedy theater and flying light aircraft.About SitePointSitePoint specializes in publishing fun, practical, and easy-to-understand contentfor web professionals. Visit http://www.sitepoint.com/ to access our books,newsletters, articles, and community forums.The Online ReferenceThe online version of this reference is located at http://reference.sitepoint.com/css.The online version contains everything in this book, fully hyperlinked andsearchable. The site also allows you to add your own notes to the content and toview those added by others. You can use these user-contributed notes to help us tokeep the reference up to date, to clarify ambiguities, or to correct any errors.Your FeedbackIf you wish to contact us, for whatever reason, please feel free to email us atbooks@sitepoint.com. We have a well-manned email support system set up to trackyour inquiries. Suggestions for improvement are especially welcome.Reprint PermissionsDo you want to license parts of this book for photocopying, email distribution,Intranet or Extranet posting or for inclusing in a coursepack? Please go toCopyright.com and type in this book’s name or ISBN number to purchase areproduction license.

vTable of ContentsChapter 1What Is CSS? . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 1CSS Versions . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 4Linking CSS to a Web Document . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 5Media Queries . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 14Standards Mode, Quirks Mode, and Doctype Sniffing . . . . . . . . . . . . . . . 17Summary . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 20Chapter 2General Syntax andNomenclature . . . . . . . . . . . . . . . . . . . . . . . . . . . . .23Statements . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 25At-rules . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 25Rule Sets . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 26Selectors . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 26Declaration Blocks . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 28Declarations, Properties, and Values . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 28Keywords . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 29Lengths and Units . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 29Percentages . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 32Colors . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 33Numbers . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 37Strings . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 37URIs . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 38Initial Values . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 39Shorthand Properties . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 39CSS Comments . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 42CSS Identifiers . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 43CSS Escape Notation . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 43

viThe Ultimate CSS ReferenceCSS Syntax Errors . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 44Summary . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 45Chapter 3At-rules Reference . . . . . . . . . . . . . . . . . . . . . . . 47@charset . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 48@import . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 49@media . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 51@page . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 52@font-face . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 54@namespace . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 55Chapter 4Selector Reference . . . . . . . . . . . . . . . . . . . . . . . 59Universal Selector . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 60Element Type Selector . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 62Class Selector . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 63ID Selector . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 65Attribute Selector . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 67CSS3 Attribute Selectors . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 71Selector Grouping . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 72Combinators . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 73Descendant Selector . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 74Child Selector . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 76Adjacent Sibling Selector . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 77General Sibling Selector . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 79Pseudo-classes . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 80:link . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 83:visited . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 84:active . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 85:hover . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 86

vii:focus . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 87:first-child . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 88:lang(C) . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 89CSS3 Pseudo-classes . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 90Pseudo-elements . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 106:first-letter . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 107:first-line . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 110:before . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 113:after . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 114::selection . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 115Chapter 5The Cascade, Specificity, andInheritance . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 117The Cascade . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 118!important Declarations . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 124Specificity . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 126Inheritance . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 133The CSS Property Value inherit . . . . . . . . . . . . . . . . . . . . . . . . . . . . 135Summary . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 137Chapter 6CSS Layout and Formatting . . . . . . . . . 139The Viewport, the Page Box, and the Canvas . . . . . . . . . . . . . . . . . . . . . 141The CSS Box Model . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 142Containing Block . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 147Collapsing Margins . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 148The Internet Explorer 5 Box Model . . . . . . . . . . . . . . . . . . . . . . . . . 156The Internet Explorer hasLayout Property . . . . . . . . . . . . . . . . . . . . 158Formatting Concepts . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 163Block Formatting . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 164

viiiThe Ultimate CSS ReferenceInline Formatting . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 166List Formatting . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 168Table Formatting . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 168Replaced Elements . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 175Positioning . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 176Relative Positioning . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 176Absolute Positioning . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 178Fixed Positioning . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 178Stacking Contexts . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 179Floating and Clearing . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 180The Relationship Between display, position, and float . . . . . . . . . 184Summary . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 185Chapter 7Box Properties . . . . . . . . . . . . . . . . . . . . . . . . . . . 187Dimensions . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 187height . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 188min-height . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 190max-height . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 192width . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 194min-width . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 196max-width . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 198Margins . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 200margin-top . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 200margin-right . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 202margin-bottom . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 205margin-left . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 207margin . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 209Padding . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 211padding-top . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 212padding-right . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 213

ixpadding-bottom . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 215padding-left . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 216padding . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 218Borders and Outlines . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 220border-top-color . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 220border-top-style . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 222border-top-width . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 224border-top . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 226border-right-color . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 228border-right-style . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 229border-right-width . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 232border-right . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 233border-bottom-color . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 235border-bottom-style . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 236border-bottom-width . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 239border-bottom . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 240border-left-color . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 242border-left-style . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 243border-left-width . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 246border-left . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 247border-color . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 249border-style . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 251border-width . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 254border . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 255outline-color . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 258outline-style . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 259outline-width . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 260outline . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 261

xThe Ultimate CSS ReferenceChapter 8Layout Properties . . . . . . . . . . . . . . . . . . . . . . . 263display . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 264position . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 267float . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 269clear . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 271visibility . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 273top . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 275right . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 276bottom . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 277left . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 278z-index . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 279overflow . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 280clip . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 283List Properties . . . . . . . . . . . . . . . . . . . . . . . . . . .285list-style-type . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .list-style-position . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .list-style-image . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .list-style . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .286288289290Chapter 9Chapter 10Table Properties . . . . . . . . . . . . . . . . . . . . . . . . . 291table-layout . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .border-collapse . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .border-spacing . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .empty-cells . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .caption-side . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .292293294295297

xiChapter 11Color and Backgrounds . . . . . . . . . . . . . . 299background-color . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 299background-image . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 301background-repeat . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 303background-position . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 305background-attachment . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 309background . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 312color . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 315Chapter 12Typographical Properties . . . . . . . . . . . . 317font-family . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 318font-size . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 320font-weight . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 321font-style . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 323font-variant . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 324font . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 325letter-spacing . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 326word-spacing . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 327line-height . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 328text-align . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 330text-decoration . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 332text-indent . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 334text-transform . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 335text-shadow . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 337vertical-align . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 338white-space . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 341direction . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 343unicode-bidi . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 344

xiiThe Ultimate CSS ReferenceGenerated Content . . . . . . . . . . . . . . . . . . . . .347content . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .counter-increment . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .counter-reset . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .quotes . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .348352354355Chapter 13Chapter 14User Interface Properties . . . . . . . . . . . . 357cursor . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 358Chapter 15Paged Media Properties . . . . . . . . . . . . . . 361page-break-before . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 362page-break-inside . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 363page-break-after . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 364orphans . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 365widows . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 366Chapter 16Vendor-specific Properties . . . . . . . . . . . 367Mozilla Extensions . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .-moz-border-radius . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .-moz-box-sizing . . .

intricacies of CSS, this is the book you need. The Ultimate CSS Reference is the definitive resource for mastering CSS. The entire language is clearly and concisely covered, along with browser compatibility details, working examples, and easy-to-read descriptions. Authored by two of the world’s most renow