Home > Articles > Programming > Web Services/ XML/ SOA/ WebSphere/ WCF

Cleaning Your Web Pages with HTML Tidy

  • PrintPrint
  • Share ThisShare This
  • DiscussDiscuss
Even with the push for web standards, many web pages are still plagued by sloppy coding. Technical writer Scott Nesbitt looks at fixing problems with HTML files using HTML Tidy.

Introduction

After many years and the efforts of countless evangelists, web standards are finally being taken seriously by people who build web pages, or any other kind of HTML document. But badly-formed HTML—the kind that doesn't conform to the standards laid down by the World Wide Web Consortium—is still a problem. You've probably seen what I'm talking about all over the web: closing tags that are MIA, proprietary extensions like <font> and <center>, and other constructs that break in all but one or two browsers.

So how do you get around the problem of bad HTML? You could use one of the many applications or online services that validate HTML syntax. More often than not, though, these applications and services are good but not great. Most will check HTML but not correct it. If you have a lot of files, you must check each file and make corrections by hand. This takes a lot of time and effort.

Or you could turn to HTML Tidy.

HTML Tidy (hereafter just Tidy) is free software, weighing in at under 500KB, and it doesn't just check HTML files; it fixes the problems it finds—and does a whole lot more. Tidy is an anachronism in the world of the graphical user interface. It's a command-line application, meaning that you have to type a string of commands to get Tidy to run. It sounds like an old-fashioned way of doing things; in fact, it's anything but. The command-line interface gives Tidy a great deal of flexibility.

This tutorial teaches you the basics of working with Tidy. I can't cover all of the aspects of Tidy in this article, but I can give you enough information to set you on the road to mastering the software. You'll learn how to run the program, use Tidy's options at the command line, and use Tidy with configuration files to make your work more efficient. I'll even point you to some web editing software in which Tidy is integrated.

NOTE

This article only looks at using Tidy at the Windows or Linux command line. However, the syntax for other operating systems is the same.

  • Share ThisShare This
  • Your Account

Discussions

Make a New Comment

You must log in in order to post a comment.

Related Resources

Jennifer  BortelWin FREE iPhone Developer Books and Videos- Introducing @InformIT Giveaways
By Jennifer Bortel on February 5, 2010 No Comments

Apples’s recent iPad announcement made our hearts flutter so we couldn’t resist making an announcement of our own!

Today marks the first ever @InformIT Giveaway!

We’ll regularly post a video like this one profiling spectacular prizes we’re giving away—from books and videos to T-shirts and other exciting stuff. Check out the video below to see the giveaways for today, and then scroll down for more prize details and instructions on how to win them!

Dustin Sullivan"Every OSX developer should have this book on their desk."
By Dustin Sullivan on February 1, 2010 No Comments

That was the sentence Mike Riley ended his recent Dr Dobb's CodeTalk review of Cocoa Programming Developer's Handbook with.

David ChisnallCocoa Tip of the Day, 1/29/10
By David Chisnall on January 29, 2010 No Comments

Don't ignore old versions of OS X.

See All Related Blogs

Informit Network