Programming Lesson #1

This is for my new student whom I'll call "Mr. Infrastructure." He wants to learn LAMP programming (Linux / Apache / MySQL / PHP). He knows some HTML. I visited a web site he wrote and immediately decided on this lesson one:

Lesson One: Valid XHTML

Mr. Infrastructure had written a web site that is nowhere near XHTML valid. He's in good company. I shudder to think how few web sites out there are valid according to any standard, let alone XHTML 1.0 (or higher). Also, I had to have my nose rubbed in validation by a professor before I started doing it.

Leaving aside other reasons for validating web pages, it's a great programming lesson. Programming languages simply won't work if they are not syntactically valid. The reason that invalid XHTML works is that browsers have been written to do the best they can with junk. Programming language parsers will simply die with an error message.

Here's a minimal valid web page.

Note that as the HTML standard approached HTML 4.01/XHTML 1.0, logical structure of a page stayed in the HTML markup, and presentation--color, position, font, etc.--was moved to style tags, CSS (cascading style sheets), etc. In Mr. Infrastructures home page, I saw a lot of old-fashioned tags that don't exist in XHTML.

Keep in mind that XHTML tags are all lower case, and you have to use them in a first-in, last-out manner (a stack)--you can't have tags in the order p, a, close p, close a. It must be p, a, close a, close p.

Also, when you first start programming, syntax errors (invalid code) will plague you. I used to spend hours debugging them. Now, I see syntax errors in moments. Don't beat yourself up too hard looking; it'll just give you ulcers. That's when you need to consult someone.

HTMLHelp.com has lots of good info on HTML 4 and CSS. This page ends with a link to the W3C's validator. Note that you can also upload and cut and paste code at the main link.

So, assignment one is to play with some web pages and validate them. Go as far as you want--simple HTML, or add some style. This page has a bit of style as an example.

I got started with much of what I know from Professor Brown's Spring 2005 web development class. See discussion of new links below.

2016/12/06 - The next link was broken. Here is Professor Brown's current link. I suspect if you trace it down, he still has a lot of info on the web. As of fall 2016, he's still teaching web dev.

2012/08/06 - fixed link to Prof Brown's class. For the record, the old URL was

page first posted around 6:10pm EST Jan 27, 2011. Updated around 6:18pm, then 6:20pm.

Valid XHTML 1.0 Strict