Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Find every instance of a CSS id/class across a whole site

Tags:

css

joomla

Before making a CSS change that might possibly have unintended consequences, what's a good way to find where else on the whole site (not just this page) that id or class is used? (It doesn't have to be exhaustive, and semi-manual processes are ok, too.)

For a bit of context, it's a Joomla-based site with a lot of content, and I'm not yet familiar with most of it. The id in question has a two letter name, and I have no idea where else it might be used. I don't have direct access to the server for any grep-like approaches.

The only technique I can think of is using Stylish to make an obvious change to that one selector, and browsing the site for a bit to see where it pops up.

like image 218
Steve Bennett Avatar asked Feb 28 '12 13:02

Steve Bennett


People also ask

How do I target my CSS ID?

To use an ID selector in CSS, you simply write a hashtag (#) followed by the ID of the element. Then put the style properties you want to apply to the element in brackets.

How do I find the CSS class of a website?

If you're using the Chrome inspector (right click page, inspect element), highlight the line and look to the right. It should show the CSS class and any rules that are used, and a link to the CSS file.

How do I identify a class and ID in CSS?

In the CSS, a class selector is a name preceded by a full stop (“.”) and an ID selector is a name preceded by a hash character (“#”).

How do I see all classes in CSS?

Focus that input and hit Ctrl + Space. A pick list of all class styles in the current opened document should appear.


1 Answers

The easiest way would be a local grep, but since you don't have access to the server, try downloading it locally using wget:

wget -r -l --domains=http://yourdomain.com http://yourdomain.com

That'll recursively retrieve pages from your domain to an infinite depth, but only following links to pages within your domain. Once it's on disk, do a local grep and you're golden.

like image 143
Karl Barker Avatar answered Oct 04 '22 02:10

Karl Barker