Beginning HTML5 and CSS3

Richard Clark, Oli Studholme, Christopher Murphy and Divya Manian Contents

Contents at a Glance iv

Forewords xv

About the Authors xvi

About the Technical Reviewers xvii

Acknowledgments xviii

Introduction xix

Who is this book for? xix How is this book structured? xix Conventions used in this book xix

Chapter 1: HTML5: Now, Not 2022 1 Basic tenets 1 A approach 2 The Dao of : embracing uncertainty 4 Accessibility 6 Crafting your markup 7 How was HTML5 created? 8 Beyond HTML 4 8 XHTML 1.0 8 XHTML 2.0 and the backlash 9 HTML5 moving forward! 10 HTML5 design principles 11 Supporting existing content 12 Degrading gracefully 12 Don't reinvent the wheel 13 Paving the cowpaths 13 Evolution, not revolution 13 A dozen myths about HTML5 14 1. Browsers don't support HTML5 14 2. OK, most browsers support HTML5, but IE surely doesn't 14 3. HTML5 won't be finished until 2022 14 4. Now I have to relearn everything! 15 5. HTML5 uses presentational elements 15 6. HTML5 is a return to tag soup 15 7. HTML5 kills accessibility kittens 15 8. Flash is dead 15 9. HTML5 will break the Web! 15 10. HTML5's development is controlled by browser vendors 15 11. HTML5 includes CSS3, Geolocation, SVG, and every other modern technology under the sun 16 12. So when can I start using HTML5? 16 Summary 16 Homework 17 Chapter 1 homework 17 Directed reading 17

Chapter 2: Your First Plunge into HTML5 19 Homework review 19

Our page 20 84.8% of your markup remains 21 It's all in the head 22

A more perfect DOCTYPE 23 Declaring languages in HTML5 23 Character encoding 25 Mr. Memory 25 A "Hello World!" journey 26 "Hello World!" in XHTML1.0 style 26 "Hello World!" in HTML4 style 27 "Hello World!" in HTML5 "loose" style 27 "Hello World!" in HTML5 "strict" style 28 Supporting HTML5 cross-browser 29 How do browsers deal with unknown elements? 29 Meet the shiv 31 IE print protector 32 Declaring block-level elements 32 An HTML5 boilerplate page 33 No more type attribute 33 Polyfills and alternatives 34 Validation 35 HTML5 35 HTML Lint 37 Revisiting Miss Baker 38 Summary 40 Homework 41

Chapter 3: New Structural Elements 43 Workflow practices, evolving? 44 A brave new semantic dawn 45

vi Structural building blocks:

,
, and
49 The difference between
,
, and
49

Which one to choose? 50 Basic structures using these elements 51 Headings:

,
, and

-

, plus