HTML5
Pocket Primer
LICENSE, DISCLAIMER OF LIABILITY, AND LIMITED WARRANTY
By purchasing or using this book and disc (the Work), you agree that this license grants permission to use the contents contained herein, including the disc, but does not give you the right of ownership to any of the textual content in the book / disc or ownership to any of the information or products contained in it. This license does not permit uploading of the Work onto the Internet or on a network (of any kind) without the written consent of the Publisher. Duplication or dissemination of any text, code, simulations, images, etc. contained herein is limited to and subject to licensing terms for the respective products, and permission must be obtained from the Publisher or the owner of the content, etc., in order to reproduce or network any portion of the textual material (in any media) that is contained in the Work.
MERCURY LEARNING AND INFORMATION (MLI or the Publisher) and anyone involved in the creation, writing, or production of the companion disc, accompanying algorithms, code, or computer programs (the software), and any accompanying Web site or software of the Work, cannot and do not warrant the performance or results that might be obtained by using the contents of the Work. The author, developers, and the Publisher have used their best efforts to insure the accuracy and functionality of the textual material and/or programs contained in this package; we, however, make no warranty of any kind, express or implied, regarding the performance of these contents or programs. The Work is sold as is without warranty (except for defective materials used in manufacturing the book or due to faulty workmanship).
The author, developers, and the publisher of any accompanying content, and anyone involved in the composition, production, and manufacturing of this work will not be liable for damages of any kind arising out of the use of (or the inability to use) the algorithms, source code, computer programs, or textual material contained in this publication. This includes, but is not limited to, loss of revenue or profit, or other incidental, physical, or consequential damages arising out of the use of this Work.
The sole remedy in the event of a claim of any kind is expressly limited to replacement of the book and/or disc, and only at the discretion of the Publisher. The use of implied warranty and certain exclusions vary from state to state, and might not apply to the purchaser of this product.
HTML5
Pocket Primer
Oswald Campesato
M ERCURY L EARNING A ND I NFORMATION
Dulles, Virginia
Boston, Massachusetts
New Delhi
Copyright 2014 by M ERCURY L EARNING AND I NFORMATION LLC. All rights reserved.
This publication, portions of it, or any accompanying software may not be reproduced in any way, stored in a retrieval system of any type, or transmitted by any means, media, electronic display or mechanical display, including, but not limited to, photocopy, recording, Internet postings, or scanning, without prior permission in writing from the publisher.
Publisher: David Pallai
M ERCURY L EARNING AND I NFORMATION
22841 Quicksilver Drive
Dulles, VA 20166
www.merclearning.com
1-800-758-3756
O. Campesato. HTML5 Pocket Primer.
ISBN: 978-1-938549-10-6
The publisher recognizes and respects all marks used by companies, manufacturers, and developers as a means to distinguish their products. All brand names and product names mentioned in this book are trademarks or service marks of their respective companies. Any omission or misuse (of any kind) of service marks or trademarks, etc. is not an attempt to infringe on the property of others.
Library of Congress Control Number: 2013942930
131415321 Printed in the United States of America
This book is printed on acid-free paper.
Our titles are available for adoption, license, or bulk purchase by institutions, corporations, etc.
For additional information, please contact the Customer Service Dept. at 1-800-758-3756 (toll free).
Digital versions of our titles are available at: www.authorcloudware.com
The sole obligation of M ERCURY L EARNING AND I NFORMATION to the purchaser is to replace the book and/or disc, based on defective materials or faulty workmanship, but not based on the operation or functionality of the product.
Id like to dedicate this book to my parents
may this bring joy and happiness into their lives.
PREFACE
WHAT YOU NEED TO KNOW FOR THIS BOOK
Y ou need an understanding of CSS2 and a basic knowledge of HTML Web pages and JavaScript. If you want to be sure that you are able to absorb the material in this book, glance through some of the code samples to get an idea of how much is familiar to you and how much is new for you.
THE TARGET AUDIENCE
This book is intended to reach an international audience of readers with highly diverse backgrounds in various age groups. While many readers know how to read English, their native spoken language is not English (which could be their second, third, or even fourth language). Consequently, this book uses standard English rather than colloquial expressions that might be confusing to those readers. As you know, many people learn by different types of mimicry, which includes reading, writing, or hearing new material (yes, some basic videos are also available). This book takes these points into consideration in order to provide a comfortable and meaningful learning experience for the intended readers.
GETTING THE MOST FROM THIS BOOK
Some programmers learn well from prose, others learn well from sample code (and lots of it), which means that theres no single style that works perfectly for everyone.
Moreover, some programmers want to run the code first, see what it does, and then return to the code to understand the details (and others use the opposite approach).
Consequently, there is a variety of code samples in this book. Some are short, some are long, and other code samples build from earlier code samples.
The goal is to show (and not just tell) you a variety of visual effects that are possible, some of which you might not find anywhere else. You benefit from this approach because you can pick and choose the visual effects and the code that creates those visual effects.
WHY SO MANY CODE SAMPLES?
One of the primary rules of exposition of virtually any kind is show, dont tell. Although thats not taken literally in this book, this is the motivation for showing first and telling second.
Perform a simple experiment: when you see the code samples and the accompanying graphics effects in this book, determine if its more effective to explain (tell) the visual effects or to show them.
If the adage a picture is worth a thousand words is true, then this book endeavors to provide both the pictures and the words.
DOESNT THE DVD OBVIATE THE NEED FOR THIS BOOK?
The DVD contains all the code samples to save you time and effort from the error-prone process of manually typing code into an HTML Web page. In addition, there are situations in which you might not have easy access to DVD. Furthermore, the code samples in the book provide explanations that are not available on the DVD.
Finally, as mentioned earlier in this Preface, there are some introductory videos available that cover HTML5, CSS3, HTML5 Canvas, and SVG. Navigate to the publishers Web site to obtain more information regarding their availability.