BlogMatrix
 

CSS selectors

edit David Janes 2006-01-05 17:09 UTC

CSS2 has a neat ability to do something called a selector. A selector allows you (amongst other things) to define CSS rules that match things other than classes and tag names.

For example this defines a CSS rule that says all JAJAH include blocks are to be hidden.

a[rel=jahah-include] {
    display: none;
}

But what if we want to have other types of inclusions, say for AHAH? And what if we want to have a general concept of “follow the link” when we see an include?

CSS defines a special attribute selector rule for matching called ”|=” which means:

Match when the element’s “att” attribute value is a hyphen-separated list of “words”, beginning with “val”. The match always starts at the beginning of the attribute value. [...]

So, in the spirit of being a team player. I’m going to reverse the order of the words. My new rule is

a[rel|=include] {
    display: none;
}

and hence forth the include marker will be rel=“include-jahah”

Tagged: css, jahah, ahah.