2

There is a CSS selector that I want to target, but only on one specific page.

Normally I would write something like this:

.page-id-70 a{
    text-decoration: underline;
}

But this selector is in a different form, it's inside brackets:

[class*="span"]  {
    margin-left: 82px;
}

Is there a way to target a selector like that on a single page ID?

1
  • What does “target a selector” even mean? Commented Apr 29, 2014 at 4:01

1 Answer 1

1

The best way to do this is to either use Developer Tools (Chrome is usually the best), and right click on the DOM element and select 'Copy CSS Path'.

Although, if this exact path is also on other pages, it may be best to include the class you want to modify within the page itself. For example, in the Wordpress edit, just add <style> .myClass{ styles here } </style> at the top of the edit box.

For example, go to the page that you would like to edit. Make sure you are in the text or html view, not the visual view. Then paste the following at the very top:

<style>
#boxedWrapper > div:nth-child(5) > div.span12.animated.activate.fadeIn {
    margin-left:82px;
}
</style>
Sign up to request clarification or add additional context in comments.

6 Comments

Sorry, don't fully understand your answer - copying the CSS path I get: #boxedWrapper > div:nth-child(5) > div.span12.animated.activate.fadeIn So if I want to as suggested above how do I take that path and for example margin-left:82px; And by the 'edit box' you just mean the WordPress page edit box?
Added more to my answer, check it out @user3583694
Thank you very much, I greatly appreciate your assistance.
Glad I could help. Don't forget to up-vote and accept it as the correct answer for others if they come across the same problem :)
I guess I can't up-vote yet because I need to have 15 reputation, but I did accept it as the correct answer. Thanks again for the good advice that worked perfectly.
|

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.