Link to home
Start Free TrialLog in
Avatar of steva
steva

asked on

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
Avatar of Bill Prew
Bill Prew

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
Avatar of steva

ASKER

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".
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
Avatar of steva

ASKER

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.
Can you send me a link to the "Contact Us" page of your site.


»bp
ASKER CERTIFIED SOLUTION
Avatar of steva
steva

Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial
Great, glad you found a way to solve your need.


»bp
Avatar of steva

ASKER

It was the only right answer