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

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 UTC