I am in charge of redesigning our companies Informational Website that was designed about 20 years ago in Microsoft FrontPage. It has been updated pretty crudely over the years and now there is random CSS and HTML (version 2 to 5) inline tags scattered throughout. It is very hard to make sense of how it all fits together and how to redesign it.
enter image description here

I am looking for a tool that I can run on the HTML files to get rid of:

  • Inline CSS
  • HTML inline formatting (size="" face="" color="")
  • Class and ID tags
  • HTML table formatting (not through CSS - border="" cellpadding="" valign="")

But I do want to keep the href tags so I don't break any links.

  • 1
    I have not tried it myself on such a mess (reminds me of the HTML exports MSWord did), but if you're using Firefox, you might wish to take a look at the HTML Validator Addon. It offers a "cleanup" button, and in that mode has an option to replace "font tags etc." with CSS (see screenshots). As I've not used this part of the addon, I cannot tell about the outcome – but it's worth a try. AFAIK, it's using HTML Tidy as back-end for cleanup. – Izzy May 8 '14 at 20:36
  • I had to do something similar with an export from a web app to excel, for certain fields it brought over all the formatting content as well. I wrote a quick macro that went through the content and removed certain items...not ideal and not a program but it may work for you...so long as the content follows a certain pattern you should be able to script removal. I only suggest it because this sounds like a one time project, not a recurring activity. – James May 20 '14 at 20:31
  • @James I had tried to do this too but after the Macro I wrote went through the code, half of it was left because of all the crappy formatting and random placement of HTML and CSS code. This website has been modified so badly I'm surprised it still renders properly. – user1086 May 20 '14 at 20:37
  • 1
    Alright without proper tagging/formatting that is going to be a challenge to automate. Good luck. – James May 20 '14 at 20:38

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy