Selectors - [attr]

  • Supported only by Opera 5+, Netscape 6 and Konqueror.
  • Buggy in iCab: all paragraphs become blue.
  • Omniweb translates P[align] as p.
  •  

    How to select elements with a certain attribute.

    Testsheet:

    P[align] {color: #cc0000;}
    P[ownattribute] {color: #0000cc;}
    

    The P[align] selector means "each element P with an attribute ALIGN". So the next paragraph should become red and the rest shouldn't.

    Test paragraph with ALIGN=left. It should become red.

    As to P[ownattribute], it's a test to see if non-standard HTML attributes are allowed. They are in Netscape 6, but Konqueror gets confused by them and makes all paragraphs blue.

    Test paragraph with OWNATTRIBUTE=set. It might become blue.

    A last test paragraph.

    Contents