Welcome to WebmasterWorld Guest from 54.146.221.231

Forum Moderators: not2easy

Message Too Old, No Replies

Software to clean up old CSS?

     
10:23 am on Jan 14, 2012 (gmt 0)

Moderator

WebmasterWorld Administrator ewhisper is a WebmasterWorld Top Contributor of All Time 10+ Year Member

joined:Feb 13, 2003
posts:4741
votes: 3


I have a few sites that have been around for a long time and the css files have grown out of control.

As the sties have moved or changed, more gets added to the css files; and its not always edited or cleaned.

So now, there are a lot of items in the CSS file that isn't used at all by the site.

Is there software (or another way) where you can load a page or several pages and the software will tell you what elements are not being used in the CSS file?
11:20 am on Jan 14, 2012 (gmt 0)

Senior Member

WebmasterWorld Senior Member 5+ Year Member

joined:Aug 9, 2008
posts: 961
votes: 0


Welcome to css eWhisper,

There are extensions for firefox that allow you to do this in the browser if you only want to check a few pages.

One is the "Unused selectors" in Pagespeed, which is an extension to firebug. Two others are "Css Usage" (another extension to firebug which allows you to export the "cleaned" css file) and "Dustme selectors" which is a separate extension for firefox. The development of the last two has been a bit fragmented, and all three can produce "false negatives" so I'd use with care - but may be a place to start.

Edit
Just noticed the exact question was
what elements are not being used in the CSS file?
The suggested tools will identify unused css rules, which is usually the goal when trying to clean up css. But it is different from identifying HTML elements that haven't been "used" in the css. Are you sure that's what is wanted?
12:15 pm on Jan 15, 2012 (gmt 0)

Moderator

WebmasterWorld Administrator ewhisper is a WebmasterWorld Top Contributor of All Time 10+ Year Member

joined:Feb 13, 2003
posts:4741
votes: 3


Pagespeed is perfect; and the others look like they can help as well.

I use pagespeed all the time; but rarely for CSS - thank for pointing out that function - much appreciated.
 

Join The Conversation

Moderators and Top Contributors

Hot Threads This Week

Featured Threads

Free SEO Tools

Hire Expert Members