W3C home > Mailing lists > Public > www-style@w3.org > April 1998

How to tell the browser that <A> is a link.

From: Ian Hickson <exxieh@bath.ac.uk>
Date: Tue, 14 Apr 1998 18:26:38 +0100
Message-ID: <002601bd67ca$8058cd40$ca20268a@hpxu>
To: www-style@w3.org
This is an idea for CSS3, which would be very useful for using CSS with XML.

Some time ago, someone mentioned that we couldn't tell in CSS if an element
was a hyperlink or form control. What about creating a new property
"personality"? (the name is arbitary, it's the idea that counts).

Examples of use:
A[href] { personality: hyperlink; }
INPUT[type=text] { personality: edit-text; }
INPUT[type=checkbox] { personality: check-box; }
BUTTON { personality: button; }

This would let the UA know what kind of behaviour a particuar element is
expected to have, which in XML seems to be a big rendering problem.
We can't use "display:hyperlink" or such thing since whether an element is a
hyperlink or not is totally independant of if it's a block, an inline box or
a part of a table. For example, in a fictional XML document type it may be
decided to have a TBUTTON which is a table cell like TD and TH in HTML but
acts as a button. "display" would be used to say that it's a cell, and
"personality" would give it it's button-like feel.

One can go even further: for the hyperlink, to set the target of the link
would be very simple, introduce a new property "href" (to make it like HTML)
and set the initial value to "attr(href)":

A[href] { personality: hyperlink; href: attr(href); }

(the [href] is needed to ensure that target anchors (<A NAME="">) do not
become active)


Obvious problems come to mind.

For example, take the rule:
A:active { personality: check-box; }
This would obviously be completely stupid. However, the rule:
A:visited { personality: link; href: url(visited.html); }
may be of use (somewhere!). (Note - as per the spec, url() is relative to
the path of the CSS source not HTML source).

If we assume that ":tooltip" is accepted, that "content" is made more
general (applying to every rule not just ":before" and ":after") , and that
pseudo elements can appear anywhere and in any number in a selector, then:

A:hover:tooltip { personality: hyperlink; href: url(\help\visited.html);
content: 'This is a visited link.'; }

If you move your mouse over a visited link, it displays a tooltip which
contains a link to a document explaining what a visited link is. Hmm.
Interesting...

--
Ian Hickson
-----BEGIN GEEK CODE BLOCK-----
Version: 3.12   Info: www.geekcode.com
GIT/M/S d->-- s+: a--->? C++(+++)>$ U>*++++ P L+>+++++ E(+)>+++ W+++ N(+) o?
K? w@ O- !M V- PS+ PE- Y+ PGP>+ t 5+++>++++ X- R+(+++) tv b++(+++) DI++
D++(---)>++++ G>+++ e(*)>+++++ h!()(--) !r y?
------END GEEK CODE BLOCK------
Received on Tuesday, 14 April 1998 13:27:43 GMT

This archive was generated by hypermail 2.2.0+W3C-0.50 : Monday, 27 April 2009 13:53:54 GMT