XHTML in Dreamweaver and Golive

by Joe Gillespie — Sep 1, 2003

If you are starting off a new XHTML page instead of converting an old HTML page, then your WYSIWYG editor should be able to insert the correct lower case tags and handle all the differences between HTML and XHTML automatically. All you have to do is tell it that you want to work in XHTML from the outset.

Here's how to set-up the two leading WYSIWYG editors to handle XHTML. If you use something else, you will probably find similar facilities.

Macromedia Dreamweaver

When you create the new blank page in Dreamweaver, you usually choose New Page in the File menu.

In the New Page dialog, check the Make document XHTML compliant checkbox at the bottom right. Dreamweaver will then create a new page and insert the correct DocType.

After that, just go ahead and build your page as usual. Before you can validate the page however, you need to go into Preferences/Validator and checkXHTML 1.0 Transitional. When you choose File/Check Page/Validate Markup, Dreamweaver will then validate your markup against XHTML standards indicating anything that might need to be fixed manually.

Adobe GoLive

In GoLive, choose New Special in the File menu. There, you are given a number of choices of which only two are relevant.

XHTML – Basic Page – Inserts a DocType for a basic XHTML page – but it's better to choose XHTML Page – which inserts the DocType for XHTML Transitional. The other thing that it does is insert a white body background color <body bgcolor="#ffffff">. It is preferable to specify the body background within your Style Sheet, so you can delete the bgcolor="#ffffff" if you like.

Now, there's something that GoLive does with its XHTML that should be changed. In the editorial above, I said that closing tags should be (space)/> for best browser compatibility. GoLive leaves the space out which, while not disastrous, is not strictly correct. Not to worry. It's easily fixed. Just go to Edit/Find and in the Find and Replace dialog put /> in the Find box and (space)/> in the replace box. Make sure From Top is checked and click on the Replace All button.

To validate your page with GoLive's syntax checker, just make sure that XHTML 1.0 Transitional is checked.

Valid XHTML

Although Dreamweaver and GoLive do excellent jobs of syntax checking documents, if you want the definitive validation, go to the WC3 Validator. It will catch errors that the programs don't because it is more regularly updated.

Del.icio.us Digg Technorati Blinklist Furl reddit Design Float