Thông tin tài liệu
Schafer
The book you need to succeed!
Master the essential building blocks
of the Web
The first step to any Web document is to build a strong
foundation. This comprehensive book focuses on the
essential building blocks of the Web: HyperText Markup
Language (HTML), extensible HTML (XHTML),
and Cascading Style Sheets (CSS). You’ll learn basic
scripting and coding standards; how to use tags, tables,
forms, and links; the best ways to test and validate
pages; and many more techniques that help you take
full advantage of these essential tools.
Companion
Web Site
• Explore the basics of HTML such as tags, attributes, and how to
structure content to create specialized document formatting
• Learn how multimedia and scripting can be used to make your
content dynamic
• Author, validate, and troubleshoot your coding and documents
• Enable content for multiple devices—from the standard PC browser
to various mobile devices
• Understand values, lists, colors, fonts, and other CSS metrics and
formatting basics
• Get up to speed on advanced document formatting
Companion
Web Site
Code samples and examples from
the book, as well as extra material,
can be found at www.wiley.com/go/
htmlbible5e.
Steven M. Schafer
has broad experience in technology
and is a veteran of publishing. He’s
been in and around technology as a
programmer, an editor, a product
specialist, a technical manager, and
a Web developer. Steve employs
both open-source and proprietary
technologies and has worked with
the Internet since the mid-1990s.
He can be reached by e-mail at
sschafer@synergy-tech.com.
Master HTML 4.01,
CSS 2.1, and XHTML 1.1
Construct static and
dynamic Web pages
Build for a mobile and
social networking world
HTML, XHTML, and CSS
Shelving Category:
COMPUTERS / Programming
Languages / HTML, SGML
Reader Level:
Beginning to Advanced
$39.99 USA
$47.99 Canada
www.wiley.com/go/ htmlbible5e
Steven M. Schafer
Fifth Edition
Fifth Edition
HTML,
XHTML,
and
CSS
Companion Web Site
www.it-ebooks.info
HTML, XHTML,
AND CSS BIBLE
Fifth Edition
Steven M. Schafer
Wiley Publishing, Inc.
www.it-ebooks.info
HTML, XHTML, and CSS Bible, Fifth Edition
Published by
Wiley Publishing, Inc.
10475 Crosspoint Boulevard
Indianapolis, IN 46256
www.wiley.com
Copyright © 2010 by Wiley
Publishing, Inc., Indianapolis, Indiana
Published simultaneously in Canada
ISBN: 978-0-470-52396-4
Manufactured in the United States of America
10987654321
No part of this publication may be reproduced, stored in a retrieval system or transmitted in any form or by any
means, electronic, mechanical, photocopying, recording, scanning or otherwise, except as permitted under Sections
107 or 108 of the 1976 United States Copyright Act, without either the prior written permission of the Publisher,
or authorization through payment of the appropriate per-copy fee to the Copyright Clearance Center, 222 Rosewood
Drive, Danvers, MA 01923, (978) 750-8400, fax (978) 646-8600. Requests to the Publisher for permission should
be addressed to the Permissions Department, John Wiley & Sons, Inc., 111 River Street, Hoboken, NJ 07030, (201)
748-6011, fax (201) 748-6008, or online at http://www.wiley.com/go/permissions.
Limit of Liability/Disclaimer of Warranty: The publisher and the author make no representations or warranties
with respect to the accuracy or completeness of the contents of this work and specifically disclaim all warranties,
including without limitation warranties of fitness for a particular purpose. No warranty may be created or extended
by sales or promotional materials. The advice and strategies contained herein may not be suitable for every situation.
This work is sold with the understanding that the publisher is not engaged in rendering legal, accounting, or other
professional services. If professional assistance is required, the services of a competent professional person should be
sought. Neither the publisher nor the author shall be liable for damages arising herefrom. The fact that an organi-
zation or Web site is referred to in this work as a citation and/or a potential source of further information does not
mean that the author or the publisher endorses the information the organization or Web site may provide or rec-
ommendations it may make. Further, readers should be aware that Internet Web sites listed in this work may have
changed or disappeared between when this work was written and when it is read.
For general information on our other products and services please contact our Customer Care Department within the
United States at (877) 762-2974, outside the United States at (317) 572-3993 or fax (317) 572-4002.
Wiley also publishes its books in a variety of electronic formats. Some content that appears in print may not be
available in electronic books.
Library of Congress Control Number: 2009940878
Trademarks: Wiley and the Wiley logo are trademarks or registered trademarks of John Wiley & Sons, Inc. and/or
its affiliates, in the United States and other countries, and may not be used without written permission. All other
trademarks are the property of their respective owners. Wiley Publishing, Inc. is not associated with any product or
vendor mentioned in this book.
www.it-ebooks.info
Introduction xxxix
PartI:CreatingContentwithHTML 1
Chapter 1: What Is a Markup Language? 3
Chapter 2: HTML Values and Units 9
Chapter 3: What Goes into a Web Document? 17
Chapter 4: The HEAD Elements 41
Chapter 5: Text Structuring Essentials 49
Chapter 6: Character Formatting Essentials 61
Chapter 7: Lists 71
Chapter 8: Links 87
Chapter 9: Tables 101
Chapter 10: Frames 143
Chapter 11: Forms 159
Chapter 12: Colors and Images 185
Chapter 13: Multimedia 213
Chapter 14: Special Characters 231
Chapter 15: Internationalization and Localization 247
Chapter 16: Scripts 261
Chapter 17: Dynamic HTML 271
Chapter 18: The Future of HTML: HTML5 297
PartII:HTMLToolsandVariants 307
Chapter 19: Web Development Software 309
Chapter 20: Publishing Your Site 321
Chapter 21: An Introduction To XML 329
Chapter 22: Creating Mobile Documents 349
Chapter 23: Tidying and Validating Your Documents 359
Chapter 24: HTML Tips and Tricks 371
Part III: Controlling Presentation with CSS 395
Chapter 25: CSS Basics 397
Chapter 26: Style Definitions 405
Chapter 27: CSS Values and Units 421
Chapter 28: CSS Inheritance and Cascade 431
Chapter 29: Font Properties 437
Chapter 30: Text Formatting 445
Chapter 31: CSS Lists 471
Chapter 32: Padding, Margins, and Borders 479
xiii
www.it-ebooks.info
Contents at a Glance
Chapter 33: Colors and Backgrounds 491
Chapter 34: CSS Layouts 503
Chapter 35: Pseudo-Elements and Generated Content 525
Chapter 36: Dynamic HTML with CSS 539
Chapter 37: Media Styles and Defining Documents for Printing 553
Chapter 38: The Future of CSS: CSS3 571
PartIV:AdditionalCSSTools 579
Chapter 39: User Interface Styles 581
Chapter 40: Testing and Validating CSS 589
Chapter 41: CSS Tips and Tricks 595
Appendix A: XHTML Element Quick Reference 617
Appendix B: HTML Special Characters Quick Reference 667
Appendix C: CSS 2.1 Properties Quick Reference 679
Appendix D: CSS 2.1 Selectors Quick Reference 705
Appendix E: Pseudo-Elements and Pseudo-Classes Quick Reference 709
Index 711
xiv
www.it-ebooks.info
Introduction . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . xxxix
Part I: Creating Content with HTML 1
Chapter1:WhatIsaMarkupLanguage? 3
What Are We Doing Here? 3
Understanding Hypertext 4
Understanding Markup Instructions 4
Understanding Markup Language 6
Summary 8
Chapter2:HTMLValuesandUnits 9
Basic Tag Attribute Format 9
Common Attributes 12
Tag identifiers — IDs and classes 12
IDs 12
Classes 12
Text and Comments 13
Comments 13
CDATA sections 14
Uniform Resource Indicators 14
Language and International Options 15
Language code 15
Text direction 15
Summary 16
Chapter 3: What Goes into a Web Document? . . . . . . . . . . . . . . . . . . . 17
Specifying Document Type 17
Overall Document Structure: HTML, Head, and Body 18
The <html> tag 18
The <head> tag 18
The <body> tag 19
Style Definitions 20
Block Elements: Markup for Paragraphs and Other Blocks of Content 21
Formatted paragraphs 21
Headings 22
Quoted text 24
List elements 24
xv
www.it-ebooks.info
Contents
Preformatted text 26
Divisions 27
Inline Elements: Markup for Characters 28
Basic inline tags 29
Spanning text 31
Special Characters (Entities) 31
Organizational Elements 32
Tables 32
Forms 34
Linking to Other Pages 35
Images . 37
Comments 38
Scripts 38
Putting It All Together 39
Summary 40
Chapter4:TheHEADElements 41
Specifying the Document Title 41
Providing Information to Search Engines 41
Setting the Default Path 43
Script Sections 45
Style Sections 45
Specifying Profiles 45
Background Color and Background Images 46
Specifying the document background color 46
Specifying the document background image 47
Summary 48
Chapter5:TextStructuringEssentials 49
Formatting Paragraphs 49
Line Breaks 51
Divisions 52
Rules 56
Block Quotes 57
Preformatted Text 58
Summary 59
Chapter 6: Character Formatting Essentials . . . . . . . . . . . . . . . . . . . . . . 61
Methods of Text Control 61
The <font> tag 61
Emphasis and other text tags 62
CSS text control 62
Bold and Italic Text 65
Use of Emphasis Instead of Italics 66
Monospace (Typewriter) Fonts 66
Superscripts and Subscripts 67
Abbreviations 67
xvi
www.it-ebooks.info
Contents
Marking Editorial Insertions and Deletions 68
Grouping Inline Elements with the Span Tag 68
Summary 70
Chapter7:Lists 71
Understanding Lists 71
Ordered (Numbered) Lists 72
Unordered (Bulleted) Lists 77
Definition Lists 81
Nested Lists 83
Summary 85
Chapter8:Links 87
What’s in a Link? 87
Linking to a Web Page 89
Absolute versus Relative Links 90
Link Targets 92
Link Titles 93
Keyboard Shortcuts and Tab Order 94
Keyboard shortcuts 94
Tab order 95
Creating an Anchor 96
Choosing Link Colors 96
Link Destination Details . 98
The Link Tag 99
Summary 100
Chapter9:Tables 101
Parts of an HTML Table 101
Table Width and Alignment 103
Cell Spacing and Padding 107
Borders and Rules 108
Table borders 108
Table rules 110
Rows 111
Cells 112
Table Captions 114
Row Groups — Header, Body, and Footer 117
Background Colors 119
Spanning Columns and Rows 120
Grouping Columns 125
Formatting with Tables 127
Rudimentary Formatting with Tables 127
Real-world examples 131
Floating page . 132
Odd graphics and text combinations 134
xvii
www.it-ebooks.info
Contents
Navigational menus and blocks 139
Multiple columns 141
Summary 142
Chapter10:Frames 143
Frames Overview 143
Framesets and Frame Documents 144
Creating a frameset 144
The frameset tag 146
The frame tag 148
Frame margins, borders, and scroll bars 148
Permitting or prohibiting user modifications 150
Targeting Links to Frames 151
Nested Framesets 154
Inline Frames 155
Summary 158
Chapter11:Forms 159
Understanding Forms 159
Inserting a Form 162
HTTP GET 163
HTTP POST 163
Additional <form> attributes 163
Field Labels 164
Text Input Boxes 164
Password Input Boxes 165
Radio Buttons 165
Check Boxes 166
List Boxes 167
Large Text Input 169
Hidden Fields 170
Buttons 171
Images 172
File Fields 172
Submit and Reset Buttons 174
Tab Order and Keyboard Shortcuts 174
Preventing Changes 175
Fieldsets and Legends 177
Using Events with Forms 179
Form Scripts and Script Services 182
Download a handler 183
Use a script service 183
Summary 183
Chapter12:ColorsandImages 185
Web Color Basics 185
Other Means to Specify Colors 186
xviii
www.it-ebooks.info
Contents
The Evolution of Color on the Web 187
Using Proper Means to Specify Colors 191
Image Formats for the Web . 193
Image compression 193
Compression options 194
GIF 194
JPEG 195
PNG 195
Creating Graphics 196
Essential functions 196
Progressive JPEGs and interlaced GIFs 197
Using transparency 198
Animated images 199
Inserting an Image 200
Image Alignment 201
Specifying Text to Display for Nongraphical Browsers 204
Sizing an Image 205
Image Borders 206
Image Maps 208
Specifying an image map 208
Specifying clickable regions 209
Specifying regions using anchor tags 211
Specifying regions using area tags 211
Putting it all together 211
Summary 212
Chapter13:Multimedia 213
Animated Images 214
Animation and Video Formats, Plug-ins, and Players 216
Popular formats and players (plug-ins) 217
Flash 218
RealOne 218
QuickTime 218
YouTube 218
Windows Media Player 218
Embedding Media via the Object Tag 219
Embedding a Windows Media Player Using <object> 223
Embedding YouTube Videos 226
Adding Sound to Web Pages 228
Creating Multimedia Files 229
A Final Word About Multimedia 229
Summary 230
Chapter14:SpecialCharacters 231
Understanding Character Encodings 231
Special Characters 232
xix
www.it-ebooks.info
[...]... instead Although these standards are not a mandatory part of HTML 4.01, they are covered in this book because the XHTML standards are stricter, don’t hamper HTML, and prepare you for authoring documents in other XML-based languages Note Future versions of HTML are to be based on XHTML coding standards Cross-Ref Chapter 18 provides a glimpse inside HTML5 CSS 2.1 The latest CSS version is 2.1 Although... is not so cut and dried The more exact answer is as follows: HTML 4.01 /XHTML 1.1 CSS 2.1 JavaScript A few supporting applications to create and troubleshoot Web documents A few multimedia formats (graphics, video, and so on) and supporting applications The following sections explain how these diverse sets of applications converge HTML 4.01 /XHTML 1.1 HTML 4.01 is the latest version of HTML This version... xxxvii www.it-ebooks.info W elcome to HTML, XHTML, and CSS Bible, Fifth Edition This book was conceived, designed, and written to provide a comprehensive overview of the two largest Web technologies, HyperText Markup Language (HTML) and Cascading Style Sheets (CSS) This book serves as an introduction and reference to the information you need to create documents — simple and complex — for the World Wide... including XML and XHTML Basic — are also covered Part III: Controlling Presentation with CSS This part of the book covers the basics of CSS, the syntax of CSS selectors, valid properties and values, and how to use CSS properties to effectively format the various portions of your document You will also learn how to format a document for printing using CSS media types Part IV: Additional CSS Tools The... Wide Web, and especially in the last few years, standards, tools, and related applications have changed and evolved, sometimes at a very rapid pace This gives Internet books a wide realm to cover What This Book Covers What exactly is covered in this book? The easy answer is HTML and CSS, just as the title suggests; but with four plus notable versions of HTML, three plus notable versions of CSS, and a bevy... dark years of mobility .350 The Open Mobile Alliance and other standards 351 The bottom line 351 XHTML Basic 1.1 352 The XHTML Basic 1.1 doctype 352 XHTML Basic 1.1 elements .352 Special considerations .353 Screen size .354 Balancing content for bandwidth and cost 354 Input restrictions .354 Easy URLs... of HTML — the tags, attributes, and structure that make up the language You learn how to structure a document, format text, and incorporate multimedia You also learn basic and advanced scripting to lend a dynamic edge to your documents Part II: HTML Tools and Variants This part of the book covers utilities to help you author, validate, and troubleshoot your documents A few useful HTML variants and. .. Dynamic HTML with CSS 539 Accessing CSS Properties with JavaScript 539 Useful CSS Manipulation 545 Hiding and showing text 545 Picture zooming 548 Menu buttons with rollovers 549 Summary 552 xxvi www.it-ebooks.info Contents Chapter 37: Media Styles and Defining Documents for Printing 553 Understanding CSS. .. book concentrates on CSS 2.1 due to its maturity CSS version 2.0 has been around for almost a decade, is used for millions of Web pages, and is well understood by most Web designers CSS version 2.1 combines some bug fixes, exact specifications where there was some ambiguity, and a few more properties and values At its core, however, it is very much like version 2.0 Although the CSS version 3.0 specification... This version is very stable, having been released in December 1999 Although HTML version 5 (HTML5 ) is in draft stage as of this writing, the specification is probably a good year (or so) away from actual release xl www.it-ebooks.info Introduction Note, however, that this book promotes and uses XHTML 1.1 standards This includes standards such as the following: Every tag needs to be explicitly closed, whether . Web Site www.it-ebooks.info HTML, XHTML, AND CSS BIBLE Fifth Edition Steven M. Schafer Wiley Publishing, Inc. www.it-ebooks.info HTML, XHTML, and CSS Bible, Fifth Edition Published by Wiley Publishing,. sschafer@synergy-tech.com. Master HTML 4.01, CSS 2.1, and XHTML 1.1 Construct static and dynamic Web pages Build for a mobile and social networking world HTML, XHTML, and CSS Shelving Category: COMPUTERS. Languages / HTML, SGML Reader Level: Beginning to Advanced $39.99 USA $47.99 Canada www.wiley.com/go/ htmlbible5e Steven M. Schafer Fifth Edition Fifth Edition HTML, XHTML, and CSS Companion
Ngày đăng: 31/03/2014, 16:48
Xem thêm: html xhtml and css bible 5th edition, html xhtml and css bible 5th edition, Appandix D: CSS 2.1 Selectors Quick Reference