RE: CSS Questions

Just de-lurking ...

Ian Sharpe wrote:

> Still be interested in browsers supporting CSS2 though as the 
> :before and
> :after pseudo-classes also look useful. For example, could 
> prefix Headings
> with an asterisk or something to help screen readers?

It is a mixed bag. Opera 6 and Netscape 6 both have some support for this,
but support slightly different things. For example:

h1:before	{content: "* ";}

works in both browsers (caveat: Windows 98 versions).

Netscape 6 (but not Opera) also supports inserting images in this way, e.g
{content: url(image.gif)}. Combined with other selectors, you could use this
to, for example, insert a distinctive image before offsite links. Sadly,
AFAIK at present the CSS spec. doesn't allow associating an alternative
representation with this generated image.

You could also use generated content to flag up e.g. links opening in new
windows:

a[target="_blank"]:before	{content: "Warning: new window! "}

This works in Netscape 6 and Opera 6. (a[target|="_"] should work to flag
any link target starting with an underscore, but it doesn't seem to work at
the moment. So you would have to write duplicate rules for target="_top",
target="_new" etc).

Finally, Opera 6 (but not Netscape 6) allows some simple generated
numbering, which you could use to keep a bit more context on very long, but
well structured documents. For example:

h1:before
	{content: "Section " counter(number) ": ";
	counter-increment: number 1;}

will incrementally number each heading 1 through a long document. (Note that
if an h1 is hidden (using e.g. {display: none;} it does not cause the
counter to increment. So it counts visible headings, which is I guess the
most useful behaviour.)

(As a request, I would be interested to know how screen readers handle this
generated content, since it does not actually exist in the document markup).


	Hope this is useful. I use these (and more CSS, using Opera's
support of the projection media type, page-break properties etc.) to produce
HTML slide shows, which can use the full panoply of HTML accessibility
features, rather than relying on PowerPoint.

	Tom

Dr Tom James
Senior Consultant

===============================================================
Digitext - Online Information at Work

Telephone: +44 (0)1844 214690
Fax: +44 (0)1844 213434
Email: tom.james@digitext.co.uk
Web: http://www.digitext.co.uk/

Received on Tuesday, 5 February 2002 09:04:28 UTC