Join Bill Weinman for an in-depth discussion in this video introduction, part of XHTML Essential Training.
Welcome to Learning XHTML. In this course you will learn what XHTML is, what its roots are, how it differs from HTML and other versions of HTML, and how use it in your websites. XHTML stands for extensible hypertext markup language. You can think of it as HTML, but more specific or a stricter version of HTML. XHTML is described in terms of another language called XML, just as HTML was described in terms of another language called SGML.
and you'll learn a little more about XML in an upcoming lesson. The most important thing to understand about XHTML 1.0 is that it's fully backward compatible with HTML 4.0. This allows you to use XHTML documents today, and allows those documents to work properly in new browsers and old browsers alike. So you can use XHTML 1.0 today without having to abandon support for older browsers on your websites. If you received the example folders along with this course, you might want to copy the example folder to your Desktop now.
If you're using a Windows operating system, and you're copying the example folder off of a cd-rom, it's a good idea to check and make sure that the read-only bit is not set on all the files. Many versions of Windows when they copy files off of a cd-rom, set the read-only bit so that you cannot write to those files. You cannot change them even though you've copied them off of the cd. Let's take a moment and show you how to do that. Right-click on the folder for the examples and select the Properties Menu item from the pop-up menu.
In the General tab, which is the tab that should come up first, noticd the read-only attribute down here at the bottom. This may be in a slightly different place depending on your version of Windows. If there's a checkmark, or is in this case a grayed checkmark, you need to click on it. And maybe even click on it again until the checkmark is gone and the box is white and has nothing in it. When you select Apply, we're okay. You may get a pop-up menu that allows you to apply this change to this folder, and subfolders, and files.
If you do, make sure that option is selected and press Okay. Now all the files in this folder are set so that you can write to them as well as read to them. Another thing to consider at this point before we get really into the course is the text editor that you're going to use. This is the text editor I use and it's called Textpad. It's available from textpad.com and it works on all the Windows operating systems. It's an excellent text editor.
The reason you want to use a text editor and not a word processor is very important. If you use a word processor, when it saves the files even if you don't have any formatting in the file., it saves information that does not display on your screen which describes the file, describes the fonts, describes the formatting, and things like that. That'll totally mess up your Web pages. You don't want that. You need to use a text editor that saves plain text files. It saves the files exactly as you type them with just the text.
You'll notice in this text editor, some things are blue, and some things are green, and some things are black. That does not mean that it saves other formatting information along with it. That's called syntax highlighting and most modern text editors do that. But it's only in the display and that information, that color information, is not saved with the file. This text editor, and most plain text editors like it, save the files in plaintext format. It's also a good idea to consider the settings for line endings. When you save your file and transfer it to your Web server--your Web server is probably running a different operating system than your Desktop.
It may be running Windows. It may be running UNIX. Most Web servers run UNIX and most Desktops don't. Most Desktops run Windows or, a one of the Mac operating systems. The way that the text files are represented in the file, the end of a line is marked by a computer code. In the case of Windows operating systems, it's two codes: a carriage return and a line feed. In the case of Mac operating systems, it's just a carriage return. In the case of most other operating systems including UNIX that most Web servers run on, it's just a line feed.
If you're the only person that's ever going to edit the files, you may not need to worry about this. But if you expect somebody else to ever want to edit your files, you want to use a lowest common denominator line ending. And for that I usually choose the UNIX-ish line endings. In the configuration for this text editor-- I happen to know where it is in this one. It's in a different place than all the text editors so we're not going to go through those details. But somewhere in your configuration you'll find a place where it'll save files as PC, UNIX, or Mac line endings. Or it may say carriage return line feed, or bare line feed, or bare carriage return. You want to select the option for UNIX.
If you're like me and you want your files to be interoperable among different operating systems, it's a good idea to select UNIX as the lowest common denominator. Or if you have the option of just bare line feeds, that's the same thing. And so you say okay and now you're all set up. Let's talk a little bit about XHTML. This is an XHTML document, and I have several of them loaded up here in my text editor. And we'll talk more about the details of them later. This one here is a typical file and it has a little bit of content in it. This is what I call the minimalist file. This is the minimal file that's legal in the language.
And here's one that's just very simple. You'll notice that if you've ever used HTML, and if you're listening to this course you probably have, that it's very similar to HTML and has many of the same elements. So it's a language that's based on HTML. The X in XHTML stands for extensible. The XHTML language was designed to be easily extended to allow for the future of Web markup, whatever that may be. And we don't claim to know that today.
HTML was designed sort of in a hurry by a scientist so that he could share documents with other scientists. It was never designed to be a multimedia presentation language. And yet when the rest of us got hold of it, we thought, "Gee, that would be fun to put multimedia in it, to control what color things are, to control where they're laid out on the page, to make things look a certain way." The scientists really didn't care about all that stuff so it wasn't designed into the language. As a result, the people who made Web browsers and the people who use them, added things to XHTML. Things to line up the words, things to allow tabular information, things to lineup pictures, and multimedia elements and stuff. XHTML was never designed to do all of that, but the language was sort of extended a long time to do that, and it was not an easy process. Browsers today even--you can design stuff that will work in one browser and not in another.
It's actually more difficult to design stuff that works in all the browsers. XHTML was designed to head all of that off, to fix all of those problems. They're not fixed yet, but XHTML 1.0 is the first step towards getting them fixed and it's a good step. XHTML 1.0 doesn't really have any new features that aren't already available in HTML 4, but was designed to be easily extensible and to make it easier to add support for these new features in the future. In order to accomplish this, XHTML is more strict than HTML.
Here I have some HTML documents also that we can look at. And this is exactly the same document in HTML, and the same document in XHTML. You'll notice in the HTML document, for example, the p-tag just sits there and doesn't have an end tag. The end tag was optional in HTML. In XHTML it's required. All elements have to be terminated. There's no ambiguity. In HTML, the parser in the browser had to decide where the end of a paragraph is. Usually it would decide that when a new paragraph began or another block-type of thing happened.
In XHTML there's no ambiguity, and this helps the future of the language. It helps browser manufacturers to be able to build parsers that are simpler, and fit in smaller devices, like perhaps, your wristwatch someday like Dick Tracy. Stricter code also means less variance among browsers. More consistent results among different browsers and different operating systems. For the short term it may seem a little more difficult, but in the long term it's going to make our job as Web designers and Web coders a whole lot easier. So you might ask yourself, "Should I be using XHTML today? Do I have to start using XHTML today? Is the browser of tomorrow going to stop supporting all of my old pages in XHTML? Am I going to have to put a whole bunch of work into converting them?" No, I don't think so.
There's a lot of documents out there on the Web today and they're still going to be out there tomorrow. And the browser manufacturers, I think, would be shooting themselves in the foot if they stopped supporting all of those older documents. I think people wouldn't use a browser that didn't support all of those old documents. Keep in mind that XHTML is three years old as of the time that I'm recording this, and still I look out on the Web and most of the new documents that I see out on the Web are written in HTML, not in XHTML. It's going to be a long time before browser manufacturers can get away with not including support for HTML. I don't think that day will necessarily ever come.
But it is a good idea to start using XHTML. The sooner we all start using it, the sooner they'll be able to extend the language and start adding support for new features. There are three versions of XHTML today. There is version 1.0. There is version 1.1. And there's a new one called version 2.0 which is still sort of under development at the World Wide Web Consortium. Version 1.0 is the one that they call the reformulation of HTML 4.01. It is fully usable in all current browsers and in all older browsers. Version 1.1 is stricter yet, and in fact is missing a lot of the features from HTML 4.0. So version 1.1 is not usable by older browsers.
It is not supported by older browsers, and in fact it's not even supported by a lot of newer browsers. Version 1.1 is not a transitional platform, and I do not recommend that you use it for new documents. Version 2.0 is more or less a different language. It has elements that are not supported by HTML at all, and many of the elements of HTML are removed or changed in ways that make it incompatible with HTML. In fact there are many people, myself included, who wish they would've named it something besides XHTML.
XHTML 2.0 is a different language and I do not recommend that you use it. This course is about XHTML 1.0 and that's the language we'll be using in our examples. So it's a good idea today to learn XHTML 1.0, and in the future when a future version of the language is available in extended in such a way that we can use it, you'll have a good head start on learning that. Also remember that XHTML by being stricter allows you to write more conformant documents that will work more consistently on many different browsers even today and even on the older browsers.