ebook img

Sams teach yourself CSS in 24 hours Edition statement suggested by introduction. - Includes index PDF

505 Pages·2006·7.626 MB·English
by  BartlettKynn
Save to my drive
Quick download
Download
Most books are stored in the elastic cloud where traffic is expensive. For this reason, we have a limit on daily download.

Preview Sams teach yourself CSS in 24 hours Edition statement suggested by introduction. - Includes index

TTeeaacchh YYoouurrsseellff CSS 24 in Hours Kynn Bartlett 800 East 96th Street,Indianapolis,Indiana,46240 USA Sams Teach Yourself CSS in 24 Hours Acquisitions Editor Linda Bump Harrison Copyright © 2006 by Sams Publishing All rights reserved. No part of this book shall be reproduced, stored in a Development Editors retrieval system, or transmitted by any means, electronic, mechanical, Jon Steever photocopying, recording, or otherwise, without written permission from Songlin Qiu the publisher. No patent liability is assumed with respect to the use of the information contained herein. Although every precaution has been Managing Editor taken in the preparation of this book, the publisher and author assume Patrick Kanouse no responsibility for errors or omissions. Nor is any liability assumed for damages resulting from the use of the information contained herein. Project Editor International Standard Book Number: 0-672-32906-9 Mandie Frank Library of Congress Catalog Card Number: 2006920653 Copy Editor Printed in the United States of America Margo Catts First Printing: May 2006 Indexer 09 08 07 06 4 3 2 1 Heather McNeill Trademarks Proofreader Elizabeth Scott All terms mentioned in this book that are known to be trademarks or service marks have been appropriately capitalized. Sams Publishing Technical Editor cannot attest to the accuracy of this information. Use of a term in this Michelle Jones book should not be regarded as affecting the validity of any trademark or service mark. Publishing Coordinator Vanessa Evans Warning and Disclaimer Every effort has been made to make this book as complete and as accu- Multimedia Developer rate as possible, but no warranty or fitness is implied. The information Dan Scherf provided is on an “as is” basis. The author and the publisher shall have neither liability nor responsibility to any person or entity with respect to Book Designer any loss or damages arising from the information contained in this Gary Adair book. Page Layout Bulk Sales Juli Cook Sams Publishing offers excellent discounts on this book when ordered in quantity for bulk purchases or special sales. For more information, please contact U.S. Corporate and Government Sales 1-800-382-3419 [email protected] For sales outside of the U.S., please contact International Sales [email protected] Contents at a Glance Introduction....................................................................................................................1 Part I: Introduction to CSS HOUR 1 Understanding CSS.....................................................................................9 2 Getting Started with CSS..........................................................................25 3 Browser Support for CSS...........................................................................43 4 Using CSS with HTML..............................................................................63 Part II: Core Principles of CSS HOUR 5 Selectors....................................................................................................83 6 The CSS Box Model................................................................................105 7 Cascading and Inheritance...................................................................117 8 Advanced Selectors.................................................................................131 Part III: Styling Text with CSS HOUR 9 Fonts and Font Families.........................................................................145 10 Text Colors and Effects...........................................................................165 11 Backgrounds and Background Colors...................................................187 12 Styling Links...........................................................................................205 13 Lists.........................................................................................................217 14 Forms......................................................................................................233 Part IV: Layout with CSS HOUR 15 Alignment...............................................................................................253 16 Borders and Boxes..................................................................................271 17 Styling Tables..........................................................................................287 18 Box Sizing and Offset.............................................................................307 19 Absolute and Fixed Positioning.............................................................325 20 Page Layout in CSS................................................................................345 Part V: Mastering CSS HOUR 21 Web Design with CSS.............................................................................363 22 Accessibility and Print Media................................................................381 23 User Interface and Generated Content..................................................401 24 Troubleshooting and Browser Hacks.....................................................423 Part VI: Appendixes A Replacing Presentational HTML with CSS.............................................451 B Glossary..................................................................................................455 Index.......................................................................................................461 Part VII: Bonus Content Bonus Hour 1: CSS and JavaScript..................................................Website Bonus Hour 2: CSS and XML...........................................................Website Table of Contents Introduction 1 Part I: Introduction to CSS HOUR 1: Understanding CSS 9 What Are Cascading Style Sheets? ..........................................................9 The Origin of Cascading Style Sheets ..................................................11 CSS in Web Design ................................................................................13 Browser Support ....................................................................................20 Summary ..............................................................................................21 Workshop ..............................................................................................22 HOUR 2: Getting Started with CSS 25 Creating a Style Sheet ............................................................................25 Writing CSS Rules ..................................................................................28 Linking a Style Sheet to an HTML Page ..............................................36 Viewing Your Style Sheet ......................................................................38 Summary ..............................................................................................40 Workshop ..............................................................................................40 HOUR 3: Browser Support for CSS 43 The Browser Problem ............................................................................43 Modern Browsers and CSS ....................................................................50 Summary ..............................................................................................60 Workshop ..............................................................................................60 HOUR 4: Using CSS with HTML 63 Types of HTML ......................................................................................63 Style Sheets in HTML ............................................................................68 vi Sams Teach Yourself CSS in 24 Hours Classes and IDs ......................................................................................73 Summary ..............................................................................................78 Workshop ..............................................................................................78 Part II: Core Principles of CSS HOUR 5: Selectors 83 Simple Selectors ....................................................................................83 Combining Simple Selectors ..................................................................87 Pseudo-Classes and Pseudo-Elements ....................................................93 Summary ............................................................................................102 Workshop ............................................................................................102 HOUR 6: The CSS Box Model 105 Displaying Content in CSS ..................................................................105 Understanding the Box Model ............................................................108 Box Display Properties ........................................................................110 Summary ............................................................................................114 Workshop ............................................................................................114 HOUR 7: Cascading and Inheritance 117 How the Cascade Works ......................................................................117 User-Defined Style Sheets ....................................................................123 Importing CSS ......................................................................................124 Inheritance ..........................................................................................126 Summary ............................................................................................127 Workshop ............................................................................................127 HOUR 8: Advanced Selectors 131 Attribute Selectors ................................................................................131 Summary ............................................................................................139 Workshop ............................................................................................140 vii Contents Part III: Styling Text with CSS HOUR 9: Fonts and Font Families 145 Specifying Font Properties ..................................................................145 Font Families ........................................................................................152 Summary ............................................................................................162 Workshop ............................................................................................163 HOUR 10: Text Colors and Effects 165 Text Colors ..........................................................................................165 Special Text Effects ..............................................................................169 Controlling Text Spacing ....................................................................175 Summary ............................................................................................182 Workshop ............................................................................................183 HOUR 11: Backgrounds and Background Colors 187 Setting Background Color ....................................................................187 Using Background Images ..................................................................189 Summary ............................................................................................202 Workshop ............................................................................................202 HOUR 12: Styling Links 205 CSS for Link Styling ............................................................................205 Common Link-Styling Techniques ......................................................210 Summary ............................................................................................215 Workshop ............................................................................................215 HOUR 13: Lists 217 List Formatting ....................................................................................217 Summary ............................................................................................230 Workshop ............................................................................................230 HOUR 14: Forms 233 Styling Form Controls ..........................................................................233 Browser Support for Form Styles ..........................................................244 viii Sams Teach Yourself CSS in 24 Hours Summary ............................................................................................248 Workshop ............................................................................................248I Part IV: Layout with CSS HOUR 15: Alignment 253 Aligning and Indenting Text ..............................................................253 Floating Content ..................................................................................260 Summary ............................................................................................267 Workshop ............................................................................................267 HOUR 16: Borders and Boxes 271 Adjusting Boxes ..................................................................................271 Displaying Boxes ................................................................................279 Summary ............................................................................................284 Workshop ............................................................................................284 HOUR 17: Styling Tables 287 Table Formatting ................................................................................287 Applying Other Styles to Tables ..........................................................301 Summary ............................................................................................303 Workshop ............................................................................................304 HOUR 18: Box Sizing and Offset 307 Sizing Content ......................................................................................307 Content Overflow ................................................................................314 Summary ............................................................................................321 Workshop ............................................................................................321 HOUR 19: Absolute and Fixed Positioning 325 Positioning Content ............................................................................325 Absolute Positioning ............................................................................327 Layered Content ..................................................................................337 Fixed Positioning ................................................................................340 ix Contents Summary ............................................................................................342 Workshop ............................................................................................342 HOUR 20: Page Layout in CSS 345 Laying Out the Page ............................................................................345 Summary ............................................................................................358 Workshop ............................................................................................358 Part V: Mastering CSS HOUR 21: Web Design with CSS 363 Basic Principles of Web Design ............................................................363 The Role of CSS in Web Design ..........................................................368 Alternate Style Sheets ..........................................................................373 Summary ............................................................................................378 Workshop ............................................................................................379 HOUR 22: Accessibility and Print Media 381 What Is Accessibility? ..........................................................................381 Aural Cascading Style Sheets ..............................................................388 Media-Specific Style Sheets ..................................................................392 CSS Properties for the print Medium ..................................................395 Summary ............................................................................................397 Workshop ............................................................................................397 HOUR 23: User Interface and Generated Content 401 User Interface Properties ......................................................................401 Creating Content ................................................................................409 Summary ............................................................................................419 Workshop ............................................................................................419 HOUR 24: Troubleshooting and Browser Hacks 423 Troubleshooting Style Sheets ..............................................................423 Browser Hacks ......................................................................................428

See more

The list of books you might like

Most books are stored in the elastic cloud where traffic is expensive. For this reason, we have a limit on daily download.