I'm looking for a method or heuristic to follow in the situation where I am making small changes to CSS on sites which I haven't built myself.
Often there are multiple style sheets involved with rules overwritten at different points in the hierarchy (WordPress sites have this a lot). I often find myself struggling to make the changes I want, and also find myself sometimes using !important
to make things work, which I know is not ideal.
I can right-click on an element in Chrome Dev Tools and copy the selector path to get something like #sc_team_792900095_11 > div.sc_team_item_avatar > div > div > div.sc_team_item_position
I'm wondering it this is the "standard" way to target specific elements or sets of elements? Are there any potential downsides?
I have spent hours in the past building up my selectors from the classes on the element I'm inspecting and adding the classes and ids of parent elements until I can magically affect the element/s I want. Sometimes I copy the classes from the styles pane, but find that on their own, those classes aren't enough.
Have I been doing it wrong? Do people who know what they are doing generally use the copy selector
method to modify the CSS of specific elements? If not can you describe the process you use, along with the principles it is based on?