Reputation: 4008
I´m using Chrome browser and tools for developers.
Is there a way where I can hover or click an element and get the target class for CSS?
I´d like to find out how to change a certain element CSS, but I'm using Bootstrap framework and it´s not always easy to find what class to use when I'd like to change some color, margin etc..
Sorry for not including any code. But you have the best answers here :)
Upvotes: 0
Views: 24
Reputation: 2844
If you select an element (ctrl + shift + c) you can view the applied CSS in the right column. If you want an easier way to see where for example the padding was set, you can click the tab "computed" in that right pane.
There you will see all the final CSS that is applied to the selected element. You can expand each property to see where it was defined, and where it has been overridden to come to the final, computed state.
Upvotes: 1
Reputation: 471
You can open Chrome inspector and right-click an element, next go to Copy and then Copy selector. This tough is not really a dynamic solution because if the structure of the code changes the selector will not always be correct anymore. A better solution is add ID's or specific class just for selecting with javascript.
Upvotes: 1