A very nice CSS3 Selector

This is a tiny small article (more like a reminder) to show you a great CSS3 selector

Match every p element inside any container that have a particular attribute :

Here is a small example. I want my rule to match the p element inside the div with customAttribute=”1″

Content in a “p” block inside the div

Content in a “p” block outside the div

Content in a “p” block inside the div

That magical ruly would be :

a p element inside any element with customAttribute set to 1

And voilà!

I strongly suggest you to read the CSS3 specification CSS 3 Selectors specification

Leave a Reply

Your email address will not be published. Required fields are marked *