views:

102

answers:

6

how can i find in a early way that this css class is being used or not in website ?

like-

style property that i write in my css is being used or not?

and

class or id is being used in webpage?

exe:

.textstyle4{
    font:normal 12px Arial, Helvetica, sans-serif ;
    color:#777;
}

i want to know in my whole website where this css style is being used?

this is an example.

+4  A: 

If you want to see what CSS styles are being applied to an element that is being rendered on your browser you should look into using Firefox and Firebug to view the DOM and CSS information.

http://getfirebug.com/

If you are using IE8 you could use the IE8 Developer tools to do the same thing.

Roberto Hernandez
+4  A: 

The CSS Usage addon for firefox does what I think you are looking for: https://addons.mozilla.org/en-US/firefox/addon/10704/

kekekela
hey i can find this for element but really want that on which element css is applying? this is apposite in this case.
kc rajput
Not sure I'm following you, but it sounds like you might just want Firebug as Roberto suggested...that allows you to select an element and see all the styles that are being applied to it, and also any styles that are being set on it but overridden.
kekekela
@kekekela i always used firebug for about aplly css on element. but i need that where is my class being use in website?
kc rajput
Oh, I don't know of anything. That would be pretty tricky since it'd have to load all your pages and for anything that wasn't totally static content it'd have to somehow figure out all the different html you could render. I think you'd end up having to roll your own for something like that.
kekekela
A: 

So you want to be able to do something like click a CSS class and have it find all pages on your site that use that class? Not aware of any such tool, kekekela's answer of CSS Usage is probably about as close as you'll get--which will let you find what CSS an individual page uses.

STW
+1  A: 

There's also "Dust-Me", a firefox extension to find unused CSS:

https://addons.mozilla.org/en-US/firefox/addon/5392/

desau
A: 

I would be extremely careful using browser-side tools to check for unused css as they don't take server side injection of styles into account (for sure), nor javascript ones (probably...).

Just imagine something like php adding a style only when a certain condition is met or javascript adding a style after a certain action is taken.

jeroen