HTML:
A Beginners Guide
Fifth Edition
Wendy Willard
New York Chicago San Francisco Lisbon London Madrid Mexico City Milan New Delhi San Juan Seoul Singapore Sydney Toronto
Copyright 2013 by The McGraw-Hill Companies. All rights reserved. Except as permitted under the United States Copyright Act of 1976, no part of this publication may be reproduced or distributed in any form or by any means, or stored in a database or retrieval system, without the prior written permission of the publisher, with the exception that the program listings may be entered, stored, and executed in a computer system, but they may not be reproduced for publication.
ISBN: 978-0-07-180928-3
MHID: 0-07-180928-7
The material in this eBook also appears in the print version of this title: ISBN: 978-0-07-180927-6,
MHID: 0-07-180927-9
McGraw-Hill eBooks are available at special quantity discounts to use as premiums and sales promotions, or for use in corporate training programs. To contact a representative please e-mail us at .
All trademarks are trademarks of their respective owners. Rather than put a trademark symbol after every occurrence of a trademarked name, we use names in an editorial fashion only, and to the benefit of the trademark owner, with no intention of infringement of the trademark. Where such designations appear in this book, they have been printed with initial caps.
Information has been obtained by McGraw-Hill from sources believed to be reliable. However, because of the possibility of human or mechanical error by our sources, McGraw-Hill, or others, McGraw-Hill does not guarantee the accuracy, adequacy, or completeness of any information and is not responsible for any errors or omissions or the results obtained from the use of such information.
TERMS OF USE
This is a copyrighted work and The McGraw-Hill Companies, Inc. (McGrawHill) and its licensors reserve all rights in and to the work. Use of this work is subject to these terms. Except as permitted under the Copyright Act of 1976 and the right to store and retrieve one copy of the work, you may not decompile, disassemble, reverse engineer, reproduce, modify, create derivative works based upon, transmit, distribute, disseminate, sell, publish or sublicense the work or any part of it without McGraw-Hills prior consent. You may use the work for your own noncommercial and personal use; any other use of the work is strictly prohibited. Your right to use the work may be terminated if you fail to comply with these terms.
THE WORK IS PROVIDED AS IS. McGRAW-HILL AND ITS LICENSORS MAKE NO GUARANTEES OR WARRANTIES AS TO THE ACCURACY, ADEQUACY OR COMPLETENESS OF OR RESULTS TO BE OBTAINED FROM USING THE WORK, INCLUDING ANY INFORMATION THAT CAN BE ACCESSED THROUGH THE WORK VIA HYPERLINK OR OTHERWISE, AND EXPRESSLY DISCLAIM ANY WARRANTY, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO IMPLIED WARRANTIES OF MERCHANTABILITY OR FITNESS FOR A PARTICULAR PURPOSE. McGraw-Hill and its licensors do not warrant or guarantee that the functions contained in the work will meet your requirements or that its operation will be uninterrupted or error free. Neither McGraw-Hill nor its licensors shall be liable to you or anyone else for any inaccuracy, error or omission, regardless of cause, in the work or for any damages resulting therefrom. McGraw-Hill has no responsibility for the content of any information accessed through the work. Under no circumstances shall McGraw-Hill and/or its licensors be liable for any indirect, incidental, special, punitive, consequential or similar damages that result from the use of or inability to use the work, even if any of them has been advised of the possibility of such damages. This limitation of liability shall apply to any claim or cause whatsoever whether such claim or cause arises in contract, tort or otherwise.
To Corinna and Caelithat you might remember your mom once knew some cool stuff, even when HTML becomes for you what eight-track tapes are to me. Heaven and earth will pass away, but my words will never pass away.
Luke 21:33
About the Author
Wendy Willard is a designer, consultant, writer, and educator who has been involved in web design and development for more than 17 years. She has published on HTML, CSS, web design, and Photoshop. Shes previously held the titles of Art Director, Creative Director, and Marketing Manager at firms in the Northeast, and now freelances for companies worldwide. Wendy has a degree in Illustration from Art Center College of Design in Pasadena, California, and splits her time between Maine, Maryland, and Nicaragua, with her husband and two daughters.
About the Technical Editor
Christie Sorenson is a senior software engineer at ZingChart. She has worked on JavaScript-based systems in analytics, content management, and business applications since 1997 and has been fascinated with the evolution of the language and its users. She has collaborated on several books, including Ajax: The Complete Reference and HTML & CSS: The Complete Reference and was also the tech editor on JavaScript: The Complete Reference and JavaScript: A Beginners Guide. She has a B.S. in Computer Science from UC San Diego and now lives in San Francisco with her husband Luke and daughters Ali and Keira.
Contents at a Glance
Contents
Acknowledgments
A s always, Im so grateful to everyone at McGraw-Hill Education for making it easy to write and update this book. This edition underwent a pretty significant overhaul, which meant it needed a careful and dedicated technical editor. Thankfully, Christie fulfilled that role beautifully.
Because I wrote this revision during the first three months after my family and I moved to Nicaragua for a year, I cannot forget to acknowledge the various friends and family who helped make it happen. The support, prayers, and encouragement we received were instrumental in getting our familys grand adventure off to a successful start.
And finally, Wyeth, Corinna, and Caeliyou are my inspiration and my reward. I am humbled and honored to be able to share this adventure with you.
Introduction
W hen I was first approached about writing this bookover 13 years ago nowI must admit that my thought was, Another HTML bookhow many do we need? I learned HTML by experience when there was only one version of Netscape, and it had been a long time since Id even looked at an HTML book. But after I researched the other HTML books on the market, I felt compelled to write a book that gives readers a realistic, easy-to-understand approach to learning HTML while at the same time offering real-world practice activities and advice on related issues.
HTML: A Beginners Guide is that book, offering you practical tools and knowledge that can easily be applied to a variety of development situations, without the boring rhetoric or lengthy technical fluff. This book tells you what you need to know, when you need to know it. In revising this book for the fifth edition, I again reviewed competing books to determine what readers wanted and needed in a new HTML book. Again and again, I saw that you wanted a book that combined an explanation of HTML5 and the latest aspects of CSS in a way that was easy to understand and use. Furthermore, readers clamored for a beginning-level HTML book that covered the standards-compliant way to code usable web pages. This is that book.
Who Should Read This Book
Since this book is geared toward anyone with little or no prior HTML knowledge, its perfect for anyone wishing to learn HTML. If you are a stay-at-home mom who wants to create a web site for your family without relying on half-baked tools or cookie-cutter templates, youve come to the right place. If you are a business professional seeking to acquire web development skills, this is the book for you. If you are interested in learning HTML to further your programming skills, this book is for you.