Tài liệu Sams Teach Yourself CSS in 24 Hours- P1 doc

50 729 0
  • Loading ...
1/50 trang

Thông tin tài liệu

Ngày đăng: 21/01/2014, 16:20

Please purchase PDF Split-Merge on www.verypdf.com to remove this watermark.201 West 103rd St., Indianapolis, Indiana, 46290 USATeach Yourselfin24HoursKynn BartlettCSS01 0672324091FM 6/13/02 10:40 AM Page iPlease purchase PDF Split-Merge on www.verypdf.com to remove this watermark.Sams Teach Yourself CSS in 24 HoursCopyright © 2002 by Sams PublishingAll rights reserved. No part of this book shall be reproduced, stored in aretrieval system, or transmitted by any means, electronic, mechanical, photo-copying, recording, or otherwise, without written permission from the publisher.No patent liability is assumed with respect to the use of the information containedherein. Although every precaution has been taken in the preparation of thisbook, the publisher and author assume no responsibility for errors or omissions.Nor is any liability assumed for damages resulting from the use of the informationcontained herein.International Standard Book Number: 0-672-32409-1Library of Congress Catalog Card Number: 2002100942Printed in the United States of AmericaFirst Printing: July 2002Second printing with corrections: December 200205 04 03 02 4 3 2TrademarksAll terms mentioned in this book that are known to be trademarks or servicemarks have been appropriately capitalized. Sams Publishing cannot attest to theaccuracy of this information. Use of a term in this book should not be regardedas affecting the validity of any trademark or service mark.Warning and DisclaimerEvery effort has been made to make this book as complete and as accurate aspossible, but no warranty or fitness is implied. The information provided is onan “as is” basis. The author and the publisher shall have neither liability norresponsibility to any person or entity with respect to any loss or damages aris-ing from the information contained in this.ACQUISITIONS EDITORJill HaydenDEVELOPMENT EDITORSusan HobbsMANAGING EDITORCharlotte ClappPROJECT EDITORMatthew PurcellCOPY EDITORMichael Kopp(Publication Services, Inc.)INDEXERJessica Matthews(Publication Services, Inc.)PRODUCTION EDITORTheodore Young, Jr.(Publication Services, Inc.)PROOFREADERPhil Hamer(Publication Services, Inc.)TECHNICAL EDITORMarshall JansenTEAM COORDINATORAmy PattonMULTIMEDIA DEVELOPERDan ScherfINTERIOR DESIGNERGary AdairCOVER DESIGNERAren HowellPAGE LAYOUTJennifer FaaborgMichael TarletonJames Torbit(Publication Services, Inc.)01 0672324091FM 12/3/02 12:13 PM Page iiPlease purchase PDF Split-Merge on www.verypdf.com to remove this watermark.Contents at a GlanceIntroduction 1Part I Introduction to Cascading Style Sheets 7Hour 1 Understanding Cascading Style Sheets 92 Getting Started with CSS 213Browser Support for CSS 414Using CSS with HTML 61Part II Core Principles of CSS 79Hour 5 Selectors 816The CSS Box Model 1037 Cascading and Inheritance 115Part III Styling with CSS 129Hour 8 Fonts and Font Families 1319Text Colors and Effects 15510 Backgrounds and Background Colors 16711 Styling Links 18512 Alignment and Spacing 19913 Borders and Boxes 21714 Lists 23315 Styling Tables 24716 Page Layout in CSS 27117 Advanced CSS Layout 29918 Web Design with CSS 323Part IV Advanced Cascading Style Sheets 341Hour 19 Advanced Selectors 34320 CSS for Printing 35721 Accessibility and Internationalization 37122 User Interface and Generated Content 38701 0672324091FM 6/13/02 10:40 AM Page iiiPlease purchase PDF Split-Merge on www.verypdf.com to remove this watermark.Hour 23 CSS and JavaScript 40724 CSS and XML 429Part V Appendixes 451Appendix A How to Read W3C Recommendations 453BReplacing Presentational HTML with CSS 459CGlossary 463Index 47101 0672324091FM 6/13/02 10:40 AM Page ivPlease purchase PDF Split-Merge on www.verypdf.com to remove this watermark.ContentsIntroduction 1Part I Introduction to Cascading Style Sheets 7Hour 1 Understanding Cascading Style Sheets 9What Are Cascading Style Sheets? 10Defining Style Sheets 10Defining Cascading 10The Origin of Cascading Style Sheets 11The CSS Specifications 12Other Style Languages 13CSS in Web Design 13How CSS Is Used 14What CSS Can Do 16What CSS Can’t Do 17When to Use CSS 18Browser Support 18Workarounds for Browser Limitations 18Summary 18Q&A 19Workshop 20Quiz 20Answers 20Hour 2 Getting Started with CSS 21Creating a Style Sheet 21Software Tools for CSS 22Naming and Saving a Style Sheet 25Writing CSS Rules 25The Basic Structure of a CSS Rule 25Combining CSS Rules 27CSS Comments 28Simple CSS Properties for Text Formatting 29Linking a Style Sheet to an HTML Page 32A Simple HTML Page for Styling 32Linked Style Sheets in HTML 35Adding More Styles 35Viewing Your Style Sheet 37Recommended Browsers 3701 0672324091FM 6/13/02 10:40 AM Page vPlease purchase PDF Split-Merge on www.verypdf.com to remove this watermark.vi Sams Teach Yourself CSS in 24 HoursSummary 37Q&A 38Workshop 38Quiz 38Answers 39Activity: Create Your First Style Sheet 39Hour 3 Browser Support for CSS 41The Browser Problem 42How Browsers Deal with CSS 42The Importance of Workarounds 45Browser Compatibility Charts 46Web Standards and You 46CSS Support in Current Browsers 47Internet Explorer 48Netscape 50Opera 51Other Browsers 53Summary 56Browser Support Report Card 57Q&A 58Workshop 59Quiz 59Answers 59Activity: Browser Test-drive 59Hour 4 Using CSS with HTML 61Types of HTML 62HTML 4.01 62XHTML 64Validating HTML 64Style Sheets in HTML 65Linked Style Sheets 65Embedded Style Sheets 68Inline Style Attributes 70Classes and IDs 71Theclass Attribute in HTML 72Class Selectors in CSS 73Theid Attribute in HTML 75id Selectors in CSS 75Summary 76Browser Support Report Card 76Q&A 7601 0672324091FM 6/13/02 10:40 AM Page viPlease purchase PDF Split-Merge on www.verypdf.com to remove this watermark.Workshop 77Quiz 77Answers 77Activity: Using HTML and CSS Together 78Part II Core Principles of CSS 79Hour 5 Selectors 81Simple Selectors 81Using class and id Selectors 82The Universal Selector 85Combining Simple Selectors 86Grouping Selectors 86Descendant Selectors 87Pseudo-classes and Pseudo-elements 91Simple Pseudo-classes 92Pseudo-elements in CSS 97Summary 100Browser Support Report Card 100Q&A 101Workshop 101Quiz 101Answers 101Activity 102Hour 6 The CSS Box Model 103Displaying Content in CSS 103Types of Elements 104Thedisplay Property 105Understanding the Box Model 106Documents as Trees 107Documents as Boxes 108Box Display Properties 109Themargin Property 110Theborder Property 111Thepadding Property 111Summary 112Browser Support Report Card 112Q&A 113Workshop 113Quiz 113Answers 114Contents vii01 0672324091FM 6/13/02 10:40 AM Page viiPlease purchase PDF Split-Merge on www.verypdf.com to remove this watermark.viii Sams Teach Yourself CSS in 24 HoursHour 7 Cascading and Inheritance 115How the Cascade Works 116Order of the Cascade 118Cascading and HTML Attributes 119Using!important in Rules 120User-defined Style Sheets 121Importing CSS 122The@import Rule 123Inheritance 124Inherited Values 125Calculated Values 125Specifying Inheritance 125Summary 125Browser Support Report Card 126Q&A 126Workshop 127Quiz 127Answers 127Activity 128Part III Styling with CSS 129Hour 8 Fonts and Font Families 131Specifying Font Properties 131The font-weight Property 132Thefont-variant Property 135Thefont-style Property 136Thefont-stretch Property 137Thefont-size-adjust Property 138Thefont Shorthand Property 140Font Families 141The Generic Font Families 141Commonly Installed Fonts 148Downloadable Fonts and Font Descriptors 149Browser Support for Downloadable Fonts 150Summary 150Browser Support Report Card 151Q&A 151Workshop 151Quiz 151Answers 152Activity 15301 0672324091FM 6/13/02 10:40 AM Page viiiPlease purchase PDF Split-Merge on www.verypdf.com to remove this watermark.Hour 9 Text Colors and Effects 155Text Colors 155Specifying Color Values 156Using Color Effectively 158Special Text Effects 159Thetext-decoration Property 159Thetext-transform Property 162Thetext-shadow Property 163Summary 164Browser Support Report Card 165Q&A 165Workshop 165Quiz 165Answers 166Activity 166Hour 10 Backgrounds and Background Colors 167Setting Background Color 168Thebackground-color Property 168Using Background Images 170Thebackground-image Property 171Thebackground-repeat Property 174Thebackground-position Property 177Thebackground-attachment Property 180Thebackground Shorthand Property 182Summary 182Browser Support Report Card 182Q&A 183Workshop 183Quiz 183Answers 184Activity 184Hour 11 Styling Links 185CSS for Link Styling 185The:link and :visited Pseudo-classes 186The:active Pseudo-class 187The:hover Pseudo-class 188The:focus Pseudo-class 190Common Link-styling Techniques 191Replacing HTML <body> Attributes 191Removing Underlines 192Mouseover Effects 193Contents ix01 0672324091FM 6/13/02 10:40 AM Page ixPlease purchase PDF Split-Merge on www.verypdf.com to remove this watermark.[...]... webdev@samspublishing.com Mail: Mark Taber Associate Publisher Sams Publishing 800 East 96th Street Indianapolis, IN 4 6240 USA Reader Services For more information about this book or any other Sams Publishing title, visit our Web site at www.samspublishing.com Type either the ISBN (excluding hyphens) or the title of a book into the Search field to find the page you’re looking for Introduction Way back in. .. book, Sams Teach Yourself CSS in 24 Hours, comes with a promise to you, the reader The promise is that in 24 hours—or less—I’ll have you up and running with CSS, producing your own style sheets that rival those of Web grandmasters To do this, I’ve broken down that 24- hour period into 24 lessons of one hour or less Now, let’s be honest—you really should not try to do everything in the book in 24 hours... fonts CSS Level 2 includes and extends all properties and values defined in CSS Level 1 In this book, I won’t make a distinction between a property that originated in CSS Level 1 and CSS Level 2; Level 2 is the current standard and the definitions in CSS2 supercede those in CSS1 Other Style Languages CSS isn’t the only style language, but it’s the primary one used on the Web Some other style languages include... called CSS- P—were introduced in CSS Level 1 and allow you Understanding Cascading Style Sheets to format a Web page without using tables Some of the things you can do with CSS to affect the graphical layout of the page include • Setting a background graphic and controlling its location, tiling, and scrolling • Drawing borders and outlines around sections of a page • Setting vertical and horizontal margins... as a CSS editor; as I’m assuming you can create HTML files, anyone reading this book should have access to a text editor In Hour 2, I’ll give you some specific pointers to CSS editors The CSSin24hours.com Web Site This book has a companion site maintained by the author—that’s me—at http://www.CSSin24hours.com/ At that site, you’ll find • Downloadable copies of all code samples in the book • Live links... “Danger, Will Robinson!” warning alarm If there’s a possibility of you turning down the wrong path, I’ll be there to steer you clear of it 5 6 Sams Teach Yourself CSS in 24 Hours Ready, Set, Go! Are you eager to start? Ready your browser, sit yourself in front of your computer in a comfortable position, and go on to the first hour! Let me know how well you’ve done at teaching yourself Cascading Style Sheets;... centered in a box with a thin outline You can do some of this in HTML using tags and various attributes, but that can get cumbersome and difficult to maintain When you define your presentation styles in CSS, it becomes quick and easy to apply new styles that can affect all styles on a page or even the whole site—without having to edit the source HTML at all! Defining Cascading The term “Cascading” in. .. Cascading Style Sheets specifications The following 3 4 Sams Teach Yourself CSS in 24 Hours browsers are recommended; you should have at least one of the following browsers installed on your system: • Internet Explorer 6.0 (or higher) for Windows (http://www.microsoft.com/ windows/ie/) • Internet Explorer 5.1 (or higher) for Macintosh (http://www.microsoft.com/mac/) • Netscape 6.2.1 (or higher) for Windows,... underlining • Indenting or centering text • Stretching and adjusting text size and line spacing • Transforming sections of text to upper-, lower-, or mixed-case • Adding drop-capitals and other special effects These are all accomplished by creating CSS rules to set properties on text Graphical Appearance and Layout CSS can also be used to change the look of the entire page CSS properties for positioning—sometimes... 357 Categories of Media Types 358 Linking and Importing Media-specific Style Sheets 359 Using the @media Rule 360 CSS Properties for the print Medium 361 Browsers and Printing 361 Measurements for Printing 361 Defining the Page with @page 362 Setting Page Breaks 364 Designing CSS for Print 366 Summary 367 Browser . Property 244 Summary 245 Browser Support Report Card 245 Q&A 245 Workshop 246 Quiz 246 Answers 246 Activity 246 Hour 15 Styling Tables 247 Table Formatting. Sheets 10Defining Cascading 10The Origin of Cascading Style Sheets 11The CSS Specifications 12Other Style Languages 13 CSS in Web Design 13How CSS Is Used
- Xem thêm -

Xem thêm: Tài liệu Sams Teach Yourself CSS in 24 Hours- P1 doc, Tài liệu Sams Teach Yourself CSS in 24 Hours- P1 doc, Tài liệu Sams Teach Yourself CSS in 24 Hours- P1 doc

Mục lục

Xem thêm

Gợi ý tài liệu liên quan cho bạn