Today I was doing some web development and wanted to see all the rules
in a stylesheet (CSS) that were not used for the current document. I
wrote the following Javascript code which you can paste in the Firebug
console and run:

For webkit-based browsers you can use "Developer Tools" and use "Audits" under "Web Page Performance" it says "Remove unused CSS rules". For Firefox there is also Google Page Speed: https://code.google.com/speed/page-speed/ this adds an extra section under Firebug.