Style Guide [part 1]
The Difference Between HTML and XHTML: An Overview
Think of XHTML as a rarified form of HTML. There is really very little new here. In fact, the code may look stripped down and simplified. The reason it looks that way is because it is.
Back in the old days, Web pages were made with simple text editors and tested in browsers. Due to certain deficiencies in browsers, specifically the lack of support for CSS, sophisticated page layouts had to be constructed with tables. While tables were developed for tabular data, they became accepted as the basis for page layout. Complicated table layouts, often with multiple nested tables, made HTML WYSIWYG editors necessary. The problems with tables used for layout are as follows:
- Tables do not degrade well. This means that the page may not display properly in old equipment or, more importantly, may not render well with assistive software.
- Tables, and their associated presentational code, can bloat Web pages.
- Tables lock pages into a non-transformable layout.
The New Stuff
If you've made Web pages before, the only tags that may be new to you are <div> and <span>. Think of the tags <div> and its associated end tag </div> as a container. The <span> tag is similar to <div> but it is used to surround a portion of text for special formatting. These containers replace tables used for layout.
In order for a format to be associated with a <div>, a class= or id= attribute is added like in this example <div class="classname">. Classes refer to styles that are used multiple times while ids are only used once on a page. The styles associated with a class or id are designed by the Web administrator and placed in a style sheet. When a style sheet containing the commands to format class="classname" is linked to the Web page, the <div> becomes formatted. What this looks like in the style sheet isn't important for our current purposes.
Otherwise, the basic differences Between HTML and XHTML are as follows:
- All tags and attributes must be lowercase.
- All tags require their associated end tags. For example, the list item tag,
<li>, does not require an end tag in HTML 4.0. The end tag,</li>is required in XHTML. Tags that don't have an associated end tags, like<br>, are written as follows:<br />. - Many presentational tags, such as
<font>,<b>, and<i>are deprecated and should not be used. Generally, if the tag formats something on the page it is deprecated. All the tags in a strict XHTML document, aside from<div>and<span>, will provide information about the content.
Tools Needed to Edit Valid XHTML
All you need is a simple text editor, like Windows Notepad, and a Web browser. Don't be afraid! You are being liberated! You need to learn a few commands but this will put you in control of your Web pages. Here's why you may not use programs that can create HTML documents:
- FrontPage 2000: Erases the DOCTYPE and namespace declarations which are both important and required. It creates Microsoft proprietary DHTML that Netscape cannot read. It cannot read our style sheets which makes it less than a WYSIWYG editor. It makes messy code with deprecated tags and inline styles. As used by most people, this program creates pages with access barriers.
- PowerPoint in Office XP: Creates framed pages with Microsoft proprietary script that can only be read by Internet Explorer. The code is messy and is difficult to edit. This program creates pages with access barriers.
- Word in Office XP: Have you seen the script this program creates? Do you understand it? Neither does your browser! This program creates pages with access barriers.
- Dreamweaver 4: Cannot read this site's style sheets. It allows developers to do many things which are not valid.
- Dreamweaver 6.1 MX: Cannot read this site's style sheets. This editor has features which allow for the creation of standards based Web pages. It also does things you shouldn't do. Do you know which features to avoid?
There are some minor drawbacks to editing pages with Notepad such as lack of a spell checker. Why not cut and paste the content into a program with a spell checker and adjust as needed. Sure, it's inconvenient. But is it worth it to ensure accessibility to all? Keep in mind, making accessible Web pages isn't just the right thing to do, it's also the law.
[« previous] [next »]
updated: Saturday, 20-Aug-2005 16:48:08 EDT