CSSCleaner is a simple Python script that moves the "style" attribute contents of a web page 
into a separate stylesheet.

If an ID is present in the element, then that is used; otherwise the class or class of the parent 
element is identified and used instead.

The original style content is placed in comments just inside the element for easy identification.

The purpose of this tool is to help clean up web pages where inline styles have been used too 
much and refactoring into stylesheets is required.


CSSCleaner has been tested on Python 2.6. Earlier versions may not work.

CSSCleaner requires BeautifulSoup:



python csscleaner.py url_or_filename output.css output.html