This content was uploaded by our users and we assume good faith they have the permission to share this book. If you own the copyright to this book and it is wrongfully on our website, we offer a simple DMCA procedure to remove your content from our site. Start by pressing the button below!
No part of this publication may be reproduced, stored in a retrieval system, or transmitted, in any form or by means electronic, mechanical, photocopying, or otherwise, without prior written permission of the publisher. Many of the designations used by manufacturers and sellers to distinguish their products are claimed as trademarks. Where those designations appear in the book, and Manning Publications was aware of a trademark claim, the designations have been printed in initial caps or all caps. User Friendly artwork, characters, and strips used by permission from UserFriendly.Org. All Rights Reserved. Recognizing the importance of preserving what has been written, it is Manning’s policy to have the books we publish printed on acid-free paper, and we exert our best efforts to that end. Recognizing also our responsibility to conserve the resources of our planet, Manning books are printed on paper that is at least 15 percent recycled and processed without elemental chlorine.
Manning Publications Co. 20 Baldwin Road PO Box 261 Shelter Island, NY 11964
Development editor: Copyeditor: Technical proofreader: Typesetter: Cover designer:
ISBN: 9781935182894 Printed in the United States of America 1 2 3 4 5 6 7 8 9 10 – MAL – 17 16 15 14 13 12
Cynthia Kane Tiffany Taylor Adam London Marija Tudor Marija Tudor
Introducing HTML5 markup 3 HTML5 forms 38 Dynamic graphics 73 Audio and video 119 Browser-based APIs 153 Network and location APIs 191
PART 2 LEARNING CSS3 7 8 9 10 11
231
New CSS language features 233 Layout with CSS3 271 Motion and color 313 Borders and backgrounds with CSS3 Text and fonts 392
v
351
contents preface xv acknowledgments xvii about this book xix
PART 1 LEARNING HTML5 1 1 Introducing HTML5 markup
3
Why do we need new elements? 4 New elements for page structure 7 Sectioning content 7 ❍ Headings, headers, and the outlining algorithm 9 ❍ Common page elements 15
The HTML DOCTYPE 17 New elements for content 18 Time 18 ❍ Images and diagrams with
and 21 ❍ Emphasizing words and phrases
22
HTML5’s new global attributes 23 Accessibility with ARIA 24 ❍ Extending HTML with custom attributes 26 ❍ Expressing more than just document semantics with microdata 28
The HTML5 content model 29 Browser support 32 Supporting Internet Explorer 35 ❍ Enabling HTML5 support in Internet Explorer with html5.js 36
Summary 36 vii
viii
contents
2 HTML5 forms
38
The limitations of HTML4 forms 39 Numbers, ranges, dates, and times 42 Validation 46 The required attribute 47 ❍ The min, max, and pattern attributes 47 ❍ Taking advantage of validation with CSS 49 ❍ Turning off validation 50