Head First HTML with CSS & XHTML
You want to learn HTML so you can finally create those web pages you've always wanted, so you can communicate more effectively with friends, family, fans, and fanatic customers. You also want to do it right so you can actually maintain and expand your Web pages over time, and so your web pages work in all the browsers and mobile devices out there. Oh, and if you've never heard of CSS, that's okay—we won't tell anyone you're still partying like it's 1999—but if you're going to create Web pages in the 21st century then you'll want to know and understand CSS.
Learn the real secrets of creating Web pages, and why everything your boss told you about HTML tables is probably wrong (and what to do instead). Most importantly, hold your own with your co-worker (and impress cocktail party guests) when he casually mentions how his HTML is now strict, and his CSS is in an external style sheet.
So what are you waiting for? Leave those other dusty books behind and come join us in Webville. Your tour is about to begin.
What you should know before reading this book
We begin by teaching basic HTML, then standards-based HTML 4.01, and then on to XHTML.
To write standards-based HTML or XHTML, there are a lot of technical details you need to understand that aren't helpful when you're trying to learn the basics of HTML. Our approach is to have you learn the basic concepts of HTML first (without worrying about these details), and then, when you have a solid understanding of HTML, teach you to write standards compliant HTML and XHTML. This has the added benefit that the technical details are more meaningful after you've already learned the basics.
It's also important that you be writing compliant HTML or XHTML when you start using CSS, so, we make a point of getting you to standards-based HTML and XHTML before you begin any serious work with CSS.
We don't cover every single HTML element or attribute or CSS property ever created.
There are a lot of HTML elements, a lot of attributes, and a lot of CSS properties. Sure, they're all interesting, but our goal was to write a book that weighs less than the person reading it, so we don't cover them all here. Our focus is on the core HTML elements and CSS properties that matter to you, the beginner, and making sure that you really, truly, deeply understand how and when to use them. In any case, once you're done with Head First HTML & CSS, you'll be able to pick up any reference book and get up to speed quickly on all the elements and properties we left out.
This book advocates a clean separation between the structure of your pages and the presentation of your pages.
Today, serious Web pages use HTML and XHTML to structure their content, and CSS for style and presentation. 1990s-era pages often used a different model, one where HTML was used for both structure and style. This book teaches you to use HTML for structure and CSS for style; we see no reason to teach you out-dated bad habits.
We encourage you to use more than one browser with this book.
While we teach you to write HTML, CSS, and XHTML that is based on standards, you'll still (and probably always) encounter minor differences in the way Web browsers display pages. So, we encourage you to pick at least two up-to-date browsers and test your pages using them. This will give you experience in seeing the differences among browsers and in creating pages that work well in a variety of browsers.
We often use tag names for element names.
Rather than saying "the a element", or "the 'a' element", we use a tag name, like "the <a> element". While this may not be technically correct (because <a> is an opening tag, not a full blown element), it does make the text more readable, and we always follow the name with the word "element" to avoid confusion.
Book code and downloadsDownload the example files (all .zip files):
- Chapter 1: Code
- Chapter 2: Code | Solution
- Chapter 3: Code | Solution
- Chapter 4: Code | Solution
- Chapter 5: Code | Solution
- Chapter 6: Code | Solution
- Chapter 7: Code | Solution
- Chapter 8: Code | Solution
- Chapter 9: Code | Solution
- Chapter 10: Code | Solution
- Chapter 11: Code | Solution
- Chapter 12: Code | Solution
- Chapter 13: Code | Solution
- Chapter 14: Code | Solution
- The Chapter 5 eye image is here.
View the examples online
- Chapter 1: Starbuzz Coffee
- Chapter 2: Head First Lounge, Before | After
- Chapter 3: Segway'n USA, Before | After
- Chapter 4: Starbuzz Coffee, Before | After
- Chapter 5: myPod, Before | After
- Chapter 6: Head First Lounge, Before | After
- Chapter 7: Head First Lounge and Segway'n USA, Before | After
- Chapter 8: Head First Lounge, Before | After
- Chapter 9: Segway'n USA, Before | After
- Chapter 10: Head First Lounge, Before | After
- Chapter 11: Head First Lounge, Before | After
- Chapter 12: Starbuzz Coffee, No Layout | Float Layout | Absolute Positioned Layout | Three-column Layout
- Chapter 13: Segway'n USA, Before | After
- Chapter 14: Starbuzz Coffee, Basic Form | Styled | Completed
The iPod Nano Contest
The Head First HTML with CSS & XHTML iPod Nano contest has now closed.
(opens a new window)
(opens a new window)
Buy 2 books and get the third free! Use the coupon code OPC10 when you check out.
If you can answer "yes" to all of these:
- Do you have access to a computer with a Web browser and a text editor? (If you have access to any computer manufactured in the last decade, the answer is yes.)
- Do you want to learn, understand, and remember how to create Web pages using the best techniques and the most recent standards?
- Do you prefer stimulating dinner party conversation to dry, dull, academic lectures?
You should probably back away from this book if you can answer "yes" to any of these:
- Are you completely new to computers? (You don't need to be advanced, but you should understand folders and files, simple text editing applications, and how to use a Web browser.)
- Are you a kick-butt Web developer looking for a reference book?
- Are you afraid to try something different? Would you rather have a root canal than mix stripes with plaid? Do you believe that a technical book can't be serious if HTML elements are anthropomorphized?
Ask the authors questions and chat with fellow readers in the Head First HTML with CSS & XHTML Forum.