Skip to main content

Beginning HTML, XHTML, CSS, and JavaScript

Beginning HTML, XHTML, CSS, and JavaScript

Jon Duckett

ISBN: 978-0-470-54070-1

Dec 2009

864 pages

Select type: Paperback

Product not available for purchase


An indispensable introductory guide to creating web pages using the most up-to-date standards

This beginner guide shows you how to use XHTML, CSS, and JavaScript to create compelling Web sites. While learning these technologies, you will discover coding practices such as writing code that works on multiple browsers including mobile devices, how to use AJAX frameworks to add interactivity to your pages, and how to ensure your pages meet accessible requirements.

Packed with real-world examples, the book not only teaches you how to write Web sites using XHTML, CSS and JavaScript, but it also teaches you design principles that help you create attractive web sites and practical advice on how to make web pages more usable. In addition, special checklists and appendices review key topics and provide helpful references that re-enforce the basics you've learned.

  • Serves as an ideal beginners guide to writing web pages using XHTML
  • Explains how to use CSS to make pages more appealing and add interactivity to pages using JavaScript and AJAX frameworks
  • Share advice on design principles and how to make pages more attractive and offers practical help with usability and accessibility
  • Features checklists and appendices that review key topics

This introductory guide is essential reading for getting started with using XHTML, CSS and JavaScript to create exciting and compelling Web sites.

Note: CD-ROM/DVD and other supplementary materials are not included as part of eBook file.

Introduction xxi

Chapter 1: Structuring Documents for the Web 1

A Web of Structured Documents 1

Introducing HTML and XHTML 2

Basic Text Formatting 10

Presentational Elements 19

Phrase Elements 23

Lists 30

Editing Text 38

Using Character Entities for Special Characters 39

Comments 40

The <font> Element (Deprecated) 40

Understanding Block and Inline Elements 41

Grouping Elements with <div> and <span> 42

Core Elements and Attributes 45

Attribute Groups 47

Summary 51

Exercises 52

Chapter 2: Links and Navigation 55

Basic Links 55

Understanding Directories and Directory Structures 61

Understanding URLs 62

Creating Links with the <a> Element 66

Advanced E-mail Links 76

Summary 78

Exercises 78

Chapter 3: Images, Audio, and Video 79

Adding Images Using the <img> Element 79

Using Images as Links 88

Image Maps 89

Choosing the Right Image Format 95

Adding Flash, Video, and Audio to Your Web Pages 104

Summary 127

Exercises 128

Chapter 4: Tables 131

Introducing Tables 131

Basic Table Elements and Attributes 139

Adding a <caption> to a Table 151

Grouping Sections of a Table 151

Nested Tables 158

Accessible Tables 160

Summary 164

Exercises 165

Chapter 5: Forms 167

Introducing Forms 168

Creating a Form with the <form> Element 171

Form Controls 175

Creating Labels for Controls and the <label> Element 198

Structuring Your Forms with <fieldset> and <legend> Elements 200

Focus 202

Disabled and Read-Only Controls 205

Sending Form Data to the Server 207

Summary 211

Exercises 212

Chapter 6: Frames 215

Introducing the Frameset 216

When To Use Frames 218

The <frameset> Element 219

The <frame> Element 225

The <noframes> Element 228

Creating Links Between Frames 228

Setting a Default Target Frame Using the <base> Element 230

Nested Framesets 231

Inline or Floating Frames with <iframe> 234

Summary 240

Exercises 240

Chapter 7: Cascading Style Sheets 243

Introducing CSS 244

Where You Can Add CSS Rules 250

CSS Properties 254

Controlling Text 255

Text Formatting 264

Text Pseudo-Classes 273

Selectors 276

Lengths 283

Introducing the Box Model 285

Summary 304

Exercises 304

Chapter 8: More Cascading Style Sheets 307

Links 308

Backgrounds 309

Lists 317

Tables 320

Outlines 328

The :focus and :active Pseudo-Classes 330

Generated Content 331

Miscellaneous Properties 335

Additional Rules 338

Positioning and Layout with CSS 340

Summary 355

Exercises 355

Chapter 9: Page Layout 357

Understanding the Site’s Audience 358

Page Size (and Screen Resolution) 365

Designing Pages 373

Coding Your Design 391

Developing for Mobile Devices 408

Summary 419

Exercises 419

Chapter 10: Design Issues 421

Typography 422

Navigation 440

Tables 454

Forms 456

Summary 479

Exercises 479

Chapter 11: Learning JavaScript 481

What Is Programming About? 482

How to Add a Script to Your Pages 484

The Document Object Model 488

Starting to Program with JavaScript 501

Variables 502

Operators 503

Functions 506

Conditional Statements 508

Looping 511

Events 514

Built-in Objects 516

Writing JavaScript 528

Summary 530

Exercises 531

Chapter 12: Working with JavaScript 533

Practical Tips for Writing Scripts 533

Form Validation 535

Form Enhancements 556

JavaScript Libraries 570

Summary 584

Exercises 585

Chapter 13: Putting Your Site on the Web 587

Meta Tags 588

Testing Your Site 593

Taking the Leap to Live 601

Telling the World about Your Site 607

Understanding Your Visitors 613

What Next? 616

Summary 626

Chapter 14: Checklists 627

Search Engine Optimization Checklist 627

Accessibility Checklist 631

Differences Between HTML and XHTML 635

HTML 5 637

Appendix A: Answers to Exercises 641

Appendix B: XHTML Element Reference 677

Appendix C: CSS Properties 713

Appendix D: Color Names and Values 741

Appendix E: Character Encodings 749

Appendix F: Special Characters 753

Appendix G: Language Codes 767

Appendix H: MIME Media Types 771

Appendix I: Deprecated and Browser - Specific Markup 783

Index 815

Code for Beginning HTML, XHTML, CSS, and JavaScript
Updated 9/19/12
ChapterPageDetailsDatePrint Run
1Error in Text
In the file "Chapter_01\ch01_eg09.html" in the downloadable code, the title element has the typo "Prefromatted"

Should be "Preformatted"

11-13Error in Text
The third heading in the screenshot in Figure 1-7 should say, "Creating Headings using hn Elements"

And we should avoid having the brackets on the previous heading on p11.

To create angled brackets you can use < for the < symbol and > for the > symbol.

19Error in Text
Step 4 should read:

"the name index.html" (the "h" is missing)

41Error in Text
In the downloadable source code, the "Chapter_01" folder contains both a "ch01_eg22.html" file and a "ch02_eg22.html" file; this was intentional.

91Error in Code
The 3rd line of code is now:

map name="gallery"

should be:

map name="cafe"

268Error in Text
Text currently says:

"Now, here is the rule that indents the second paragraph (ch08_eg11.css)"

Should be Chapter 7. Corrected:

"Now, here is the rule that indents the second paragraph (ch07_eg11.css)"

301Typo in Code
in the code for .codeForeground {, the first line includes within the font-family an option for "monosapce"

This should be "monospace"