Docsity

HTML & CSS The Complete Reference Fifth Edition, Slides of Computer Science

Partial preview of the text

Download HTML & CSS The Complete Reference Fifth Edition and more Slides Computer Science in PDF only on Docsity!

Mr Oddo

HTML & CSS: The Complete Reference, Fifth Edition

Thomas A. Powell

New York Chicago San Francisco Lisbon London Madrid Mexico City Milan New Delhi San Juan Seoul Singapore Sydney Toronto

Contents

Acknowledgments................................................ xxi Introduction..................................................... xxiii

  • 1 Traditional HTML and XHTML Part I Core Markup
    • First Look at HTML and XHTML
    • Hello HTML and XHTML World
      • Viewing Markup Locally
      • Viewing Markup with a Web Server
    • HTML and XHTML: Version History
    • HTML and XHTML DTDs: The Specifications Up Close
      • Document Type Statements and Language Versions
    • (X)HTML Document Structure
      • The Document Head
      • The Document Body
    • Browsers and (X)HTML
      • Validation
      • The Doctype Switch and Browser Rendering Modes
    • The Rules of (X)HTML
      • HTML Is Not Case Sensitive, XHTML Is
      • Attribute Values May Be Case Sensitive
      • (X)HTML Is Sensitive to a Single Whitespace Character
      • (X)HTML Follows a Content Model
      • Elements Should Have Close Tags Unless Empty
      • Unused Elements May Minimize
      • Elements Should Nest
      • Attributes Should Be Quoted
      • Entities Should Be Used for Special Characters
      • Browsers Ignore Unknown Attributes and Elements
    • Major Themes of (X)HTML
      • Logical and Physical Markup
      • Standards vs. Practice
      • Myths and Misconceptions About HTML and XHTML
    • The Future of Markup—Two Paths?
      • XHTML: Web Page Markup XML Style
      • HTML5: Back to the Future
    • Summary
  • 2 Introducing HTML5
    • Hello HTML5
    • Loose Syntax Returns
    • XHTML5
  • HTML5: Embracing the Reality of Web Markup viiiviii HTML & CSS: The Complete ReferenceHTML & CSS: The Complete Reference
  • Presentational Markup Removed and Redefined
    • Out with the Old Elements
    • In with the New Elements
    • Sample of New Attributes for HTML5
  • HTML5 Document Structure Changes
  • Adding Semantics
    • Marking Text
    • Indicating Dates and Time
    • Inserting Figures
    • Specifying Navigation
  • HTML5’s Open Media Effort

    • Media Considerations
  • Client-Side Graphics with
    • Drawing and Styling Lines and Shapes
    • Drawing Arcs and Curves
    • Scaling, Rotating, and Translating Drawings
    • Using Bitmaps in Drawings
    • Text Support for canvas
    • Conclusions
  • HTML5 Form Changes
    • New Form Field Types
    • Validating Data Entry
    • Autocomplete Lists
    • Miscellaneous Usability Improvements
  • Emerging Elements and Attributes to Support Web Applications
    • menu Element Repurposed
    • command Element
    • meter and progress Elements
    • details Element
    • output Element
    • The Uncertain Future of Frames
    • The draggable Attribute and the Drag and Drop API
    • contenteditable Attribute
    • spellcheck Attribute
  • Internationalization Improvements
  • HTML5 Metadata Changes
    • data-X Attributes
    • Microdata
  • HTML5: Beyond Markup
    • defer Attribute
    • HTML, JavaScript, and the DOM Renewed
    • Standardizing and Extending Ad Hoc JavaScript Conventions
  • Major HTML5 Themes
    • HTML5 Today or Tomorrow?
    • HTML5 as a Catch-All
    • HTML5: Web Politics as Usual
    • HTML5: Imperfect Improvement
  • Summary
  • 3 HTML and XHTML Element Reference
    • Flavors of HTML and XHTML
    • Core Attributes Reference
      • class
      • id
      • style
      • title
    • Language Attributes Reference
      • dir
      • lang
    • Other Common Attributes Reference
      • accesskey
      • align
      • contenteditable
      • datafld
      • dataformatas
      • datasrc
      • disabled
      • height
      • hidefocus
      • hspace
      • language
      • tabindex
      • unselectable
      • vspace
      • width
    • Common HTML5 Attributes Reference
      • accesskey
      • contenteditable
      • contextmenu
      • data-X (Custom Data Attributes)
      • draggable
      • hidden
      • itemid
      • itemprop
      • itemref
      • itemscope
      • itemtype
      • spellcheck
      • tabindex
    • Event Attributes Reference
      • HTML5 Events
      • Internet Explorer’s Extended Event Attributes
    • HTML Element Reference
      • (Comment)
      • (Conditional Comment)
      • (Document Type Definition)
      • (Anchor)
      • (Abbreviation)
      • (Acronym)
  • (Address) xx HTML & CSS: The Complete ReferenceHTML & CSS: The Complete Reference
  • (Java Applet)
  • (Image Map Area)
  • (Article)
  • (Aside)
  • (Audio)
  • (Bold)
  • (Base URL)
  • (Base Font)
  • (Bidirectional Override)
  • (Background Sound)
  • (Big Font)
  • (Blinking Text)
  • (Block Quote)
  • (Document Body)

  • (Line Break)
  • (Form Button)
  • (Canvas for Drawing)
  • (Table Caption)
  • (Center Alignment)
  • (Citation)
  • (Code Listing)
  • (Table Column)
  • (Table Column Group)
  • (Command)
  • (Comment Information)
  • (List of Prefill Data)
    • or Content in Details or Figure) (Definition Description in a Definition List
  • (Deleted Text)
  • (Additional Details)
  • (Definition)
  • (Directory List)
  • (Division)
  • (Definition List)
    • Caption in Figure or Details) (Term in a Definition List or
  • (Emphasis)
  • (Embedded Object)
  • (Form Field Grouping)
  • (Figure)
  • (Font Definition)
  • (Footer)
  • (Form for User Input)
  • (Window Region)
  • (Frameset Definition)
  • through (Headings)
  • (Document Head)
  • (Header)
  • (Header Group)
  • (Horizontal Rule)
  • (HTML Document)
  • (Italic)
  • (Inline Frame)
  • (Inflow Layer)
  • (Image)
  • (Input Form Control)
  • (Inserted Text)
  • (Index Prompt)
  • (Keyboard Input)
  • (Key Pair Generation)
  • (Form Control Label)
  • (Positioned Layer)
  • (Descriptive Legend)
  • (List Item)
  • (Link to External Files or Set Relationships)
  • (Code Listing)
  • (Client-Side Image Map)
  • (Marked Text)
  • (Marquee Display)
  • (Menu List or Command Menu)
  • (Meta-Information)
  • (Scalar Gauge)
  • (Multiple Column Text)
  • (Navigation)
  • (No Line Breaks)
  • (No Embedded Media Support)
  • (No Frame Support Content)
  • (No Script Support Content)
  • (Embedded Object)
  • (Ordered List)
  • (Option Grouping)
  • (Form Output)
  • -

    (Paragraph) - (Object Parameter) - (Plain Text) - (Preformatted Text) - (Progress Indicator) - (Quote) - (Ruby Parentheses) - (Ruby Text) - (Ruby Annotation) - (Strikethrough) - (Sample Text) -

    ## Acknowledgments

T he fifth edition of this book might as well be the first edition of a brand-new book. The HTML5 specification marks a return to past ideas and an explosion of future ideas. It took a great deal of work to put this new edition together. Given the amount of effort required, I want to make sure that all those that helped are given their due. First, I want to acknowledge the numerous fixes and improvements that came from the feedback from both my students at UCSD and readers around the world. I write these books for you, and I am glad you are putting this information to good use. I would also like to show my appreciation to the many staff members at PINT who helped on this book project in some direct or indirect way. I can’t specifically thank and mention the dozens of employees we have at PINT and my other firm Port80 Software who keep the lights on, but I’ll call a few out who warrant some extra kudos. Christie Sorenson once again helped this time with heavy lifting particularly in the CSS effort, and I can safely say that she has learned, relearned, and even forgotten more about Web development than probably anyone I know, besides maybe myself. Looking forward to more project fun in the future, Christie! Plenty of other PINTsters helped. Rob McFarlane, Andrew Simpkins, and Bryan Sleiter helped out with imagery. The project managers, particularly Mine Okano, Robin Nobel, Matt Plotner, and Olivia Chen, gave me moral support and occasional pity as I toiled away upstairs. Glenn Dawson addressed my many server changes and helped debug some annoying aspects of HTML5. Dan Whitworth assisted on a few chapters here and there and probably had nightmares about getting a call to really dive in. Joe Lima listened to some of my verbal nonsense and helped guide me to some deeper insights than I could have ever arrived at on my own. Daisy Bhonsle kept up a very long-standing proofing relationship, and I am very glad she always helps out. The student certainly has become the master. The folks at McGraw-Hill Professional are always a pleasure to work with. Meghan Riley helped guide me along, and Megg Morin didn’t lose faith, at least not completely. Thanks for being my patron the last decade, Megg! My technical editor, James Pence, probably wondered when this project was going to finish, and somehow he finished a nontechnical book of his own during the project.

xxi

I n t r o d u c t i o n xxiii

Introduction

T he fifth edition of this book represents a significant change in structure and content to address HTML5. The book is similar to the previous edition in maybe a third of the content; otherwise, it is an all-new effort. Most obviously, as compared to the previous editions, which focused mainly on XHTML and HTML 4, this edition focuses on HTML5, which represents both a return to the markup past and the unveiling of an exciting future of Web applications. However, we do retain some information from previous editions because in order for this work to be truly complete, we must not focus only on the future but also present all the elements supported in browsers today, including the archaic, proprietary, and standard (X)HTML tags. These will still be encountered for years to come, and we want this book to provide the reference you need in addressing their syntax. CSS coverage has been expanded greatly to fully cover CSS 2.1 as well as every proprietary and emerging CSS 3 property supported in one or more popular shipping browsers circa 2009. No value judgment is made; if Internet Explorer has supported a proprietary CSS feature for the last decade, it’s included. However, we do avoid presenting CSS features that are truly speculative in great depth, but where appropriate, we summarize or present pointers to the emerging syntax. The ramification of the increased markup and CSS coverage is simply the book doesn’t have space left to do everything it did before. Teaching nearly everything about HTML and CSS in prose form and then presenting a complete syntax reference for the technologies would have produced a book well over 2,000 pages. We were well on the way to that when we adjusted our efforts to create what you have in your hands, a solid reference book that may be used for years to come. This isn’t to say that learning material is not present at all. There are very solid introductory chapters for the markup and CSS sections, which should succinctly address details and standards issues. There just isn’t a step-by-step cookbook for each element or property. Given the maturity of the Web industry, we aimed not for the complete tutorial, but instead for the complete reference. It should go without saying that more markup changes to HTML and CSS are inevitable. HTML5, in particular, is a complete moving target, and rather than punting on it, we took the best shot at its first release version as it settled in late 2009. Because of the inevitable changes given HTML5’s rapid evolution, the support Web site, http://htmlref.com, should be considered an important bookmark for readers looking for updates or the unavoidable correction.

xxiiixxiii

I

Core Markup CHAPTER 1

Traditional HTML and XHTML

CHAPTER 2

Introducing HTML

CHAPTER 3

HTML and XHTML Element Reference PART