I have been trying to delve into web development. Part of this process has been incrementally tweaking things on my website, trying to learn something new with each incremental change.
For CSS there is a Firefox extension that finds unused CSS selectors on a page. It has an option to spider the whole site. Version 3.01 should work with newer versions of Firefox.
And here’s another option.
If you are using jquery you can override the $() function calling jQuery() inside that function and checking / loging the value returned from jQuery to ensure all selectors are returning some results. But its not a deterministic way of doing things.
I use Dust-Me Selectors (official site) to find orphaned selectors in my code. Works for Firefox and Opera, unfortunately I do no think it can search JS or PHP code, but will search HTML output.