How to select all paragraphs on the HTML page whose title is "About Us"

I want to select all paragrahs on the HTML page whose title is "Contact Us".  It seems like
 
[title="Contact Us"] p {color:red; };

Open in new window

should work, but it doesn't .  Does anyone see the problem?

Thanks
stevaAsked:
Who is Participating?
 
stevaConnect With a Mentor Author Commented:
I found a way to do this.  Squarespace also allows me to add custom CSS to a particular page, so I'll just do that, and then only the ps there will be affected.

Thanks
0
 
Bill PrewCommented:
Format needs to be tag[attribute-selection].  See example below.

<!DOCTYPE html>
<html>
<head>
<style>
p[title="Contact Us"] {color:red;}
</style>
</head>
<body>
<p title="Contact Us">This is paragraph one.</p>
<p>This is paragraph two.</p>
<p title="Contact Us">This is paragraph three.</p>
</body>
</html>

Open in new window


»bp
0
 
stevaAuthor Commented:
This looks like a p that has a title attribute of "Contact Us".  But what I'm looking for is all the ps that are on the page that the title attribute of "Contact Us".
0
Cloud Class® Course: MCSA MCSE Windows Server 2012

This course teaches how to install and configure Windows Server 2012 R2.  It is the first step on your path to becoming a Microsoft Certified Solutions Expert (MCSE).

 
Bill PrewCommented:
This looks like a p that has a title attribute of "Contact Us".  But what I'm looking for is all the ps that are on the page that the title attribute of "Contact Us".

Sorry, it's still not clear to me what elements you are trying to style, can you provide an HTML sample?  How are you defining "pages" in the HTML document?


»bp
0
 
stevaAuthor Commented:
I'm adding custom CSS to a Squarespace site.  The CSS goes into an area that's global to the site.  If the page that's being viewed is "Contact Us" I want all the ps on that page to have this style.
0
 
Bill PrewCommented:
Can you send me a link to the "Contact Us" page of your site.


»bp
0
 
Bill PrewCommented:
Great, glad you found a way to solve your need.


»bp
0
 
stevaAuthor Commented:
It was the only right answer
0
Question has a verified solution.

Are you are experiencing a similar issue? Get a personalized answer when you ask a related question.

Have a better answer? Share it in a comment.

All Courses

From novice to tech pro — start learning today.