Beginning HTML, XHTML, CSS, and JavaScript
Published by
Wiley Publishing, Inc.
10475 Crosspoint Boulevard
Indianapolis, IN 46256
www.wiley.com
Copyright 2010 by Wiley Publishing, Inc., Indianapolis, Indiana
Published simultaneously in Canada
ISBN: 978-0-470-54070-1
No part of this publication may be reproduced, stored in a retrieval system or transmitted in any form or by any means, electronic, mechanical, photocopying, recording, scanning or otherwise, except as permitted under Sections 107 or 108 of the 1976 United States Copyright Act, without either the prior written permission of the Publisher, or authorization through payment of the appropriate per-copy fee to the Copyright Clearance Center, 222 Rosewood Drive, Danvers, MA 01923, (978) 750-8400, fax (978) 646-8600. Requests to the Publisher for permission should be addressed to the Permissions Department, John Wiley & Sons, Inc., 111 River Street, Hoboken, NJ 07030, (201) 748-6011, fax (201) 748-6008, or online at http://www.wiley.com/go/permissions .
Limit of Liability/Disclaimer of Warranty: The publisher and the author make no representations or warranties with respect to the accuracy or completeness of the contents of this work and specifically disclaim all warranties, including without limitation warranties of fitness for a particular purpose. No warranty may be created or extended by sales or promotional materials. The advice and strategies contained herein may not be suitable for every situation. This work is sold with the understanding that the publisher is not engaged in rendering legal, accounting, or other professional services. If professional assistance is required, the services of a competent professional person should be sought. Neither the publisher nor the author shall be liable for damages arising herefrom. The fact that an organization or Web site is referred to in this work as a citation and/or a potential source of further information does not mean that the author or the publisher endorses the information the organization or Web site may provide or recommendations it may make. Further, readers should be aware that Internet Web sites listed in this work may have changed or disappeared between when this work was written and when it is read.
For general information on our other products and services please contact our Customer Care Department within the United States at (877) 762-2974, outside the United States at (317) 572-3993 or fax (317) 572-4002.
Wiley also publishes its books in a variety of electronic formats. Some content that appears in print may not be available in electronic books.
Library of Congress Control Number: 2009937840
Trademarks: Wiley, the Wiley logo, Wrox, the Wrox logo, Wrox Programmer to Programmer, and related trade dress are trademarks or registered trademarks of John Wiley & Sons, Inc. and/or its affiliates, in the United States and other countries, and may not be used without written permission. JavaScript is a registered trademark of Sun Microsystems, Inc. All other trademarks are the property of their respective owners. Wiley Publishing, Inc., is not associated with any product or vendor mentioned in this book.
About the Author
Jon Duckett has spent over a decade helping a wide range of companies implement innovative web strategies. Taking a hands-on approach, he designs many of the projects he works on and helps to code them. During this time, Jon has written several books covering web design, programming, accessibility, and usability.
About the Tech Editor
Chris Ullman is a freelance web developer and technical editor/author who has spent many years working in web technologies. Coming from a computer science background, he gravitated towards MS technologies during the summer of ASP (1997). He cut his teeth on Wrox Press ASP guides, and since then has edited or contributed to more than 30 books, most notably as lead author for Wroxs bestselling Beginning ASP/ASP.NET 1.x/2 series. He lives in Cornwall and spends his non-computing time running, writing music, and attempting with his wife, Kate to curb the enthusiasm of three very boisterous young children.
Credits
Executive Editor
Carol Long
Project Editor
William Bridges
Technical Editor
Chris Ullman
Production Editor
Daniel Scribner
Copy Editor
Nancy Rapoport
Editorial Director
Robyn B. Siesky
Editorial Manager
Mary Beth Wakefield
Marketing Manager
David Mayhew
Production Manager
Tim Tate
Vice President and Executive Group Publisher
Richard Swadley
Vice President and Executive Publisher
Barry Pruett
Associate Publisher
Jim Minatel
Project Coordinator, Cover
Lynsey Stanford
Proofreader
Nancy Hanger
Indexer
Robert Swanson
Cover Designer
Michael E. Trent
Cover Image
istockphoto.com/ Daft_Lion_Studio
Contents
Grouping Elements with
and
Element
Adding a
Creating a Form with theElement Structuring Your Forms withand Elements to a Table
Element
Introduction
There are a lot of books about designing and building web pages, so thank you for picking up this one. During the relatively short life of the Web, many technologies have been introduced to help you create web pages, some of which have lasted, others of which have disappeared. Now the dust is beginning to settle, and commonly accepted best practices are emerging; so the aim of this book is to teach you how to create pages for the Web as it is today and will be for the next few years.
This book is different from many books because it teaches you more than just the code you need to learn to write web pages; I wanted to share some of the practical experience I have gained designing and building web sites over the past 12 years. Therefore, alongside the usual technical information, you will see advice on topics that range from how to approach the task of creating a new site to chapters that let you in on the techniques used by designers to make their pages more attractive. You will also find information about important topics such as accessibility and usability that any professional web programmer needs to understand. And, once you have worked through this book, it should continue to serve as a helpful reference text you can keep nearby and dip into as you need to.
As the title of this book suggests, you will be learning a few different languages in order to create effective and attractive web pages:
- HTML and XHTML are needed to explain the structure of any web pages. If you look at this page it is made up of a lot of words. On web pages it is the job of HTML and XHTML to explain the structure of the words which words form a heading, where paragraphs start and end, and which text should have bullet points. These languages also specify links between different web pages and where images should appear.
This book focuses mainly on teaching you XHTML, but you will be glad to know that by learning XHTML you will automatically be able to write HTML (because you can consider XHTML to be exactly the same as HTML, but with a few extra rules added making it a little more strict). At the end of the book is a preview of HTML 5, the next version of HTML.
- CSS is used to control how your pages look. For example, you can use CSS to specify that a typeface should be a large, bold Arial typeface or that the background of a page should be a light green. You can also use CSS to control where different items appear on a page, such as placing three columns of text next to each other.